Rotation and MoveEntity

Blitz3D Forums/Blitz3D Beginners Area/Rotation and MoveEntity

siread(Posted 2007) [#1]
I have a soccer ball mesh that I want to rotate so that it appears to roll. If I use RotateEntity the following MoveEntity command sends it in the wrong direction because it's orientation has changed.

How can I make the ball appear to roll without changing it's orientation?


jfk EO-11110(Posted 2007) [#2]
Basicly you should work with a pivot

ball_piv=createpivot()
ball=loadmesh("ball.3ds",ball_piv)

now you can rotate the ball locally and move the pivot globally.

I think there's already some smart rolling ball code in the archives.


siread(Posted 2007) [#3]
Ah, pivots. I've managed to avoid them thus far so I have no idea how they work. Are there any good tutorials that will help me understand them?


jfk EO-11110(Posted 2007) [#4]
There isn't much to understand. They are like a mesh with zero triangles. They are mostly useful when used in parenting systems, like in my example. So it's more about understanding parent-child relations and hierarchies, as well as the optional "parent" and "global" parameter of many Blitz commands.


big10p(Posted 2007) [#5]
You can use TranslateEntity to move the ball around, regardless of it's orientation.


Buggy(Posted 2007) [#6]
You use TranslateEntity or MoveEntity on the pivot. Since you parented the ball to the pivot, the ball moves, but does not rotate. Then you use TurnEntity (I prefer it to RotateEntity) to make the ball "roll."


IPete2(Posted 2007) [#7]
Justin case you wanted to know...

theres some superb roll a ball across the floor in any direction code in the archives somewhere.



IPete2.


siread(Posted 2007) [#8]
Yes i found that and was very impressed. I'm currently in the process of re-writing my program. :)


Sir Gak(Posted 2007) [#9]
Using a pivot gives your mesh a frame of reference around which to rotate. That is to say, motions of a mesh that is a child of the pivot-parent, are moved/turned in relation to where the pivot is. To move the mesh through the 3d world, you simply move the pivot, and all child meshes go with the parent (ie the pivot in this example).