Rotation doesnt affect origin
Rotation doesnt affect origin
Hey all, i have a 3d car that can move,rotate,etc but when i rotate the 3d car
and move it forward it doesn't move forward in the direction the rotation is and resulting in a very strange car.
So i ask how do i rotate the car and the origin of it at the same time?
Thanks in advance.
and move it forward it doesn't move forward in the direction the rotation is and resulting in a very strange car.
So i ask how do i rotate the car and the origin of it at the same time?
Thanks in advance.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Life of a programmer == Const abuse
I searched but i did not get anything that helped me, if you know a good link pleas give it to me.
Thanks in advance.
Thanks in advance.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Life of a programmer == Const abuse
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
You lied to me! I feel... violated.
I need to go and lie down now, and deal with the shock. It'll be difficult to trust you after this, but... I'll try counselling if you will.
I need to go and lie down now, and deal with the shock. It'll be difficult to trust you after this, but... I'll try counselling if you will.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Your a Scot aren't you, you should be used to it by nowrogerborg wrote:You lied to me! I feel... violated.
I need to go and lie down now, and deal with the shock. It'll be difficult to trust you after this, but... I'll try counselling if you will.
Regards Wolfe
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
We never learn though.
Scotchmen: Right, Frenchies, are you up for getting stuck into the English?
Frenchies: Oui.
Scotchmen: For real this time? We'll invade from the North, you come from the South?
Frenchies: Oui.
Scotchmen: OK, we're about to go. Are you definitely going to join in this time?
Frenchies: Oui.
Scotchmen: Promise?
Frenchies: Oui.
Scotchmen: FREEEEEEEEEDOM! CHAAAAR- wait... are you invading or not?
Frenchies: (shrug) Non.
Scotchmen: (charge into a swamp and get bayoneted - again)
How many times?
Scotchmen: Right, Frenchies, are you up for getting stuck into the English?
Frenchies: Oui.
Scotchmen: For real this time? We'll invade from the North, you come from the South?
Frenchies: Oui.
Scotchmen: OK, we're about to go. Are you definitely going to join in this time?
Frenchies: Oui.
Scotchmen: Promise?
Frenchies: Oui.
Scotchmen: FREEEEEEEEEDOM! CHAAAAR- wait... are you invading or not?
Frenchies: (shrug) Non.
Scotchmen: (charge into a swamp and get bayoneted - again)
How many times?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
I did not lie to you...
The car is moving fine but the orgin doesnt change...
I swear i did not lie to you.
The car is moving fine but the orgin doesnt change...
I swear i did not lie to you.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Life of a programmer == Const abuse
rogerborg wrote:Brilliant! Have you got framerate independent motion, and movement in the correct direction working OK?
Also, I found another answer for you in that very same thread.MasterM wrote:Yup, its working in the correct direction
Deja vu, eh?rogerborg wrote: Then, as the model rotates, the forwards (and backwards) direction changes, and you'll want to calculate that direction and then add it to - or subtract it from - the model's position when it moves forwards and backwards.
To get the forwards direction, you can either use trig, matrix methods, or if you've got the latest SVN code (as I recommend because of the getTime() issue on Windows) then you can use the new vector3df::rotationToDirection() utility method to create a forwards vector directly from the node's rotation.
I think the fundamental problem here is that the origin is only a point, not a rotation. When you rotate a node, it will rotate around it's origin, but there is no "rotation" of the origin to be changed. You yourself have to manually calculate which direction to move the node to achieve movement in the correct manner; refer to either what rogerborg said in the last topic (as I have conveniently quoted above) or the link to the topic I posted earlier.
-
- Posts: 224
- Joined: Tue Oct 25, 2005 4:32 pm
- Location: Louisiana, USA, backwater country
- Contact:
To get what you want, you'll need a minorly-complex mathematical calculation to have your car travelling "forward" in relation to it's rotation.
irrlicht can most correctly be called a 3d rendering engine, as opposed to a game engine. for this matter, irrlicht does not store the "forward" orientation itself. this is up to you.
the way i like to do it, is to use a class that acts as a container for a group of nodes:
ISceneNode* parent, mesh, transform;
set the mesh and transform's parent as "parent".
when moving, set the parent's position to the transform's absolute position. then reset the transform's position to (0,0,0)
when rotating, set the parent's rotation to the transform's absolute rotation, then reset the transform's rotation to (0,0,0)
parent and transform should both be init'ed with addEmptySceneNode()
Now. i've just given you so much free information, i would be shot by the intellectual property cops. don't bug me unless you get on IRC
irrlicht can most correctly be called a 3d rendering engine, as opposed to a game engine. for this matter, irrlicht does not store the "forward" orientation itself. this is up to you.
the way i like to do it, is to use a class that acts as a container for a group of nodes:
ISceneNode* parent, mesh, transform;
set the mesh and transform's parent as "parent".
when moving, set the parent's position to the transform's absolute position. then reset the transform's position to (0,0,0)
when rotating, set the parent's rotation to the transform's absolute rotation, then reset the transform's rotation to (0,0,0)
parent and transform should both be init'ed with addEmptySceneNode()
Now. i've just given you so much free information, i would be shot by the intellectual property cops. don't bug me unless you get on IRC
When banks compete, you win.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
-
- Posts: 368
- Joined: Tue Aug 21, 2007 1:43 am
- Location: The Middle of Nowhere