Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How to access btRigidBody in Tier2 ...

Author
Message
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 27th Mar 2018 15:05 Edited at: 27th Mar 2018 15:12
Hello there,

because I was missing some bullet physics functionality in Tier2, I searched for a bullet rigid body instance in the cObject3D.h and found the attribute

Because its visibility is "protected", I added the line

to make it accessible in my CPP-Code.

The problem is, even after the call to

the function

returns NULL like "no bullet body instance allocated".

I also tried accessing the rigid body at a later point (while the main loop), because I thought maybe the real allocation wasn't made yet, but no success.

Any suggestions?
Thanks in advance!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Mar 2018 16:13
Quote: "btRigidBody* m_pRigidBody;"


That is code that Paul never cleaned up so it is not connected to the Physics so will always be null.

All the rigid bodies are handeled thru a manager.


The coffee is lovely dark and deep,and I have code to write before I sleep.
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 27th Mar 2018 19:38
Thank you very much, works perfect!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 27th Mar 2018 20:10
Just curious what functionality are you trying to add?
The coffee is lovely dark and deep,and I have code to write before I sleep.
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 31st Mar 2018 13:17
Implementing a custom character controller, therefore I need "setAngularFactor(0,1,0)" to prevent the rigid-body-cone from falling in a wrong direction.
I was missing "applyForce" and "applyTorque" also, even if you could wrap around this via "SetLinearVelocity".

Hopefully, there is something to present in the "Project"-section soon
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 31st Mar 2018 15:32

I am guessing that you are trying to use a dynamic rigid body for your character controller, this can be difficult to control.
It would probably be easier to inherit the btKinematicCharacterController class and then modify it as needed since kinematic rigid bodies
are meant to be controlled.
If you are creating a custom character controller to be able to move in more than one direction you can look at the code
in this function and easily see how to change it as it is hard coded for 4 directions.
Notice that the velocity must be divided by the scale factor before passing to Bullet and vise-versa multiplied by the scale
factor when you get it back from bullet. This also applies to sizes of the objects and positions.

The coffee is lovely dark and deep,and I have code to write before I sleep.
Sandwich
6
Years of Service
User Offline
Joined: 23rd Sep 2017
Location:
Posted: 6th Apr 2018 13:39 Edited at: 6th Apr 2018 13:40
Thanks for the advice! Good to get a deeper understanding of AGK's "behind the scenes"

Login to post a reply

Server time is: 2024-04-18 15:23:33
Your offset time is: 2024-04-18 15:23:33