Bug in ogre3d motionstate sample

theyesfish
Posts: 10
Joined: Sat Apr 11, 2009 7:12 pm

Bug in ogre3d motionstate sample

Post by theyesfish »

http://www.bulletphysics.com/mediawiki- ... tionStates

Code: Select all

    virtual void setWorldTransform(const btTransform &worldTrans) {
        if(NULL == mVisibleobj) return; // silently return before we set a node
        btQuaternion rot = worldTrans.getRotation();
        mVisibleobj->setOrientation(rot.w(), rot.x(), rot.y(), rot.z());
        btVector3 pos = worldTrans.getOrigin();
        mVisibleobj->setPosition(pos.x(), pos.y(), pos.z());
    }
Before "if(NULL == mVisibleobj) return;" you'll want the line.

mPos1 = worldTrans;

I spent a long time trying to figure out why my kinematic objects weren't working.
User avatar
kenshin
Posts: 36
Joined: Fri Oct 31, 2008 5:10 pm

Re: Bug in ogre3d motionstate sample

Post by kenshin »

theyesfish wrote:http://www.bulletphysics.com/mediawiki- ... tionStates

Code: Select all

    virtual void setWorldTransform(const btTransform &worldTrans) {
        if(NULL == mVisibleobj) return; // silently return before we set a node
        btQuaternion rot = worldTrans.getRotation();
        mVisibleobj->setOrientation(rot.w(), rot.x(), rot.y(), rot.z());
        btVector3 pos = worldTrans.getOrigin();
        mVisibleobj->setPosition(pos.x(), pos.y(), pos.z());
    }



Before "if(NULL == mVisibleobj) return;" you'll want the line.

mPos1 = worldTrans;

I spent a long time trying to figure out why my kinematic objects weren't working.

the mPos1 only need in first time that getWorldTransform.
I think there is no bug in ogre3d motionstate sample.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bug in ogre3d motionstate sample

Post by Erwin Coumans »

theyesfish wrote: Before "if(NULL == mVisibleobj) return;" you'll want the line.
mPos1 = worldTrans;
I spent a long time trying to figure out why my kinematic objects weren't working.
Thanks for the report, it is indeed a bug in the wiki documentation.
kenshin wrote: the mPos1 only need in first time that getWorldTransform.
I think there is no bug in ogre3d motionstate sample.
It is likely a bug. Have you tried kinematic objects? Kinematic objects access the 'getWorldTransform' every frame, to update their linear/angular velocity.
Thanks,
Erwin
User avatar
kenshin
Posts: 36
Joined: Fri Oct 31, 2008 5:10 pm

Re: Bug in ogre3d motionstate sample

Post by kenshin »

Erwin Coumans wrote:
theyesfish wrote: Before "if(NULL == mVisibleobj) return;" you'll want the line.
mPos1 = worldTrans;
I spent a long time trying to figure out why my kinematic objects weren't working.
Thanks for the report, it is indeed a bug in the wiki documentation.
kenshin wrote: the mPos1 only need in first time that getWorldTransform.
I think there is no bug in ogre3d motionstate sample.
It is likely a bug. Have you tried kinematic objects? Kinematic objects access the 'getWorldTransform' every frame, to update their linear/angular velocity.
Thanks,
Erwin
indeed,I haven't use the Kinematic objects until now.
it is true that a bug in the wiki documentation。
thanks