I'm working on networking and i want to update the client's Object positions.
if i do:
object->getmotionstate->setWorldTransform(trans) nothing happens to the object.
however if i do:
object->setWorldTransform(trans) it seems to generally update correctly. But it appears the rotation is wrong. Even though i'm just setting it with the numbers i got from get.
But i'm not sure if even that is what i should be doing.
I need a way to set the rotation and position but i've been unable to find a way.
Any help or suggestion would be most appreciated. Thanks
Moving btRigidBody
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: Moving btRigidBody
Because that's moving your visible object on-screen, not the actual rigid body - the next time that the physics ticks, you're going to lose that update.object->getmotionstate->setWorldTransform(trans) nothing happens to the object.
Define "wrong". Is it off by a small amount? Is the object rotating backwards instead of forwards?object->setWorldTransform(trans) it seems to generally update correctly. But it appears the rotation is wrong. Even though i'm just setting it with the numbers i got from get.
If it's the first one, your network prediction might just be squiffy?
Gary (-;
-
- Posts: 7
- Joined: Sat Jun 21, 2008 7:23 pm
Re: Moving btRigidBody
o' ok.
and its wrong as in, the objects seem almost perpendicular to where they should be.
I copy the transformation and then take each part of the position and each part of the rotation (x, y, z, and w) and send them as doubles over the network.
So perhaps its the fact that i'm sending them as doubles?
and just a side question what is the w for anyways?
and its wrong as in, the objects seem almost perpendicular to where they should be.
I copy the transformation and then take each part of the position and each part of the rotation (x, y, z, and w) and send them as doubles over the network.
So perhaps its the fact that i'm sending them as doubles?
and just a side question what is the w for anyways?
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: Moving btRigidBody
Heh. If you have to as, then you also need to ask what the x,y, and z are for, tooand just a side question what is the w for anyways?
http://en.wikipedia.org/wiki/Quaternion
The short answer, and the best way to piss off mathematicians, is '"quaternions are for avoiding gimbol lock", which is where you lose the ability to rotate your object along one or more of its axes because computers are strictly linear beasts.
What are you actually using for output? If you're seeing them always off by 90 degrees or so, then the odds are that your rendering system is using a left [or right] handed co-ordinate system, while bullet is using a right [or left] handed co-ordinate system.and its wrong as in, the objects seem almost perpendicular to where they should be.
Gary (-;
-
- Posts: 7
- Joined: Sat Jun 21, 2008 7:23 pm
Re: Moving btRigidBody
I'm using irrlicht for displaying everything.
and i thought it might be the displaying wrong as well, however i dont think that's the case because the server shows everything just fine and they both display the same way.
Thats why i've been thinking its something else.
and i thought it might be the displaying wrong as well, however i dont think that's the case because the server shows everything just fine and they both display the same way.
Thats why i've been thinking its something else.
-
- Posts: 7
- Joined: Sat Jun 21, 2008 7:23 pm
Re: Moving btRigidBody
So i think i've got it. My problem was i was sending in 1.0 for w every time, left over from earlier code. Put it in right this time and i think i got it working .
Thank you so much for everything though!
Thank you so much for everything though!
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: Moving btRigidBody
Easy mistake to make when you switch from euler to quaternionsMy problem was i was sending in 1.0 for w every time
Gary (-;