Beginner Questions

BlitzMax Forums/MiniB3D Module/Beginner Questions

Brucey(Posted 2008) [#1]
Still trying to get my head around this 3D stuff.

I have a flat panel-type thing with an image on it that I want to do pans and zooms with, so that a particular part of it can be focussed upon.

When I TurnEntity it rotates at a particular point on it. How do I change where that point is? So for instance, I might want it rotating in the centre, or towards one end of it.
Is that what a Pivot is for?

If I want to perform a set motion from point A to point B, which changes angle etc through the "flight" is there a best way to set it up? From what I can imagine you would either code it or somehow load in some preset animation from elsewhere.
I suppose the coding wouldn't be too hard... some kind of in-between timeline thing which takes a set of start and end params and runs from A-B, changing values on each step until B is reached.
Or is there a simpler way already provided?

Hope that wasn't too vague.


matty47(Posted 2008) [#2]
My understanding of the 3D concepts you need (possibly incorrect)
A pivot is a dummy object (not visible ) that you can parent a mesh to. So you place the pivot, then place the mesh at the required position in relationship to the pivot, then parent the mesh to the pivot. Now when you want to say rotate the mesh you can rotate it by rotating the pivot. Eg If you place a planar mesh so that the pivot is on one edge you can rotate the mesh around that edge by rotating the pivot. (Did that make sense?)
The motion could be set up by defining a set (array) of waypoints. You would need to calculate the direction between successive waypoints and as you move the object from waypoint to waypoint you rotate it to match the direction between the waypoints. There was some code somewhere showing how to change the direction smoothly. Maybe look for "curvevalue" (which is a command built in to DBPro).
Hope all that made sense!
Matthew


Difference(Posted 2008) [#3]
1)
you could:
Create a pivot and place it where you want your rotation center.
Parent the entity you want to rotate to the pivot with EntityParent(myentity,mypivot).
Rotate the pivot, and myentity will follow.
Unparent with EntityParent(myentity,0) if you need to move your rotation center.

2)
You can see an example of using splines for motion control in the demos/bird folder of the minib3d distribution.

There are also built in animation commands in B3D but I have not tried them with miniB3D:
http://blitzmax.com/b3ddocs/command_list_3d_cat.php?show=Entity%20Animation
I don't think you can use SetAnimKey() in miniB3D.

You can animate your object in an external application and load that, but it dosen't sound like that is what you're after.


Brucey(Posted 2008) [#4]
Thanks for the info folks :-)

A curve value function certainly helps to smooth out movement from one point to another.
I've ended up, for now, building a type which can move from A-B quite smoothly. I'm not sure how easy it would be to use splines instead, so more digging required there.

As for using an external app. It took me long enough to work out how to get an image onto a mesh! I should probably stick to writing modules in that regard. It's much easier :-)

Thanks again!


slenkar(Posted 2008) [#5]
its pretty simple really, even I can understand it

All you have to do is use the movemesh command

every 3d object has a 'center' which it rotates around

movemesh moves the mesh and the 'center' stays still
then, when you use turnentity it will display the behaviour you wanted

as for flight, you would have to create your own function