ALIGN OBJECT
Blitz3D Forums/Blitz3D Beginners Area/ALIGN OBJECT
| ||
Ok, i know this is very simple, but cant get it to work. all I want to do is have a cube move around an area.. when this cube goes up hill or downhill, or on a slope of any kiND i want it to tilt with the slope. I cant sem to get alignentity to work right.. help please |
| ||
try aligntovector,xvector,0,zvector,1,align# with xvecotr/zvector vector being the collision normal for that dir or what other values you may be getting. |
| ||
COULD YOU TELL ME WHY THIS ISNT WORKING If EntityCollided(CAR(AC),1) Then AlignToVector car(ac),CollisionNX(CAR(AC),1),0,CollisionNZ(CAR(AC),1),1,.01 AlignToVector car(ac),CollisionNX(CAR(AC),1),0,CollisionNZ(CAR(AC),1),3,.01 ResetEntity CAR(aC) EndIf |
| ||
Hey, here's something i found on my computerGraphics3D 800,600 SetBuffer BackBuffer() light=CreateLight() ground=CreatePlane() camera=CreateCamera() box=CreateCube() PositionEntity box,0,2,0 PositionEntity camera,0,6,-20 RotateEntity ground,0,0,30 EntityType ground,2 EntityType box,1 Collisions 1,2,2,2 While Not KeyHit(1) If KeyDown(200) Then MoveEntity box,0,0.1,0 If KeyDown(208) Then MoveEntity box,0,-0.1,0 If KeyDown(205) Then MoveEntity box,0.1,0,0 If KeyDown(203) Then MoveEntity box,-0.1,0,0 If KeyDown(2) Then TranslateEntity box,0,0.1,0 If EntityCollided(box,2) Then AlignToVector box,CollisionNX(box,1),CollisionNY(box,1),CollisionNZ(box,1),2 temp=CollisionNZ(box,1) col=1 Else col=0 End If UpdateWorld() RenderWorld() Text 0,0,"normalx="+temp Flip Wend End Align a cube to the plane once it collides :) |
| ||
YEAH, COPY AND PASTE YOUR CODE, IT WORKS LIKE A CHARM.. BUT IT LOOKS LIKE WHAT I WAS DOING TO BEGIN WITH.. STRANGE. thanks! |
| ||
Well, i wrote it ;P |
| ||
no, you were using 2 aligntovector commands when you should use only one. I think you mae the common mistake of thinking you had to alignto both the z and x in the specified vector to align on so thought required 2 aligntovectors. |