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 / problem with 3d physics

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 22nd May 2016 14:54
No matter what i try the whole physics stops responding after a few seconds of running,least for me it does!
I have wrote a small piece of code here:


If you run it and press space straight away then it jumps and fine, yet wait a few seconds and it fails, even if you jump straight away then wait a few seconds it simply wont jump, everything freezes physics wise, no matter what i put in the initial physics settings also!
Hail to the king, baby!
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: 22nd May 2016 21:51
https://www.appgamekit.com/documentation/Reference/3DPhysics/SetObject3DPhysicsCanSleep.htm
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 23rd May 2016 10:52 Edited at: 23rd May 2016 11:44
Blimey! Totally missed that one, thanks!

Don't you think it would have been better to have it set to 0 by default and not 1, as my brain maybe thought it to be the case before! This caused me days and days of head scratching thinking it was something wrong with the rest of the code,being it part of a much larger 3d level editor project!
Hail to the king, baby!
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: 23rd May 2016 15:09
Quote: "Don't you think it would have been better to have it set to 0 by default and not 1, as my brain maybe thought it to be the case before!"


That would defeat the purpose of sleep mode in Bullet. All dynamic objects get put to sleep by the physics engine after they come to rest.
This prevents the physics from bogging down the app. If you want to apply forces to a dynamic object you would just wake up that object
then apply forces. Bullet automatically wakes up objects when other moving dynamic objects get near so they can be affected by the other object.
If you think it should be different suggest it to Paul.
The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 25th May 2016 13:22
Well, I do guess it is how you use it all, ideally I would use the character controller but cannot get an objects velocity returned from that, pretty essential for making certain checks collision wise, for instance imagine a mario type scenario where you kill them by jumping on their heads, yet they kill you if you are not jumping on their heads at the time, this can be done easily by grabbing the velocity of the object and checking if it has reached its peak value, if so then it must be falling! It is the way I did it anyhow! hence I use the other commands
Hail to the king, baby!
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: 25th May 2016 14:12
The character controller is a kinematic controller. Kinematic objects are not controlled by the physics solver.
You can not get the velocity of a kinematic object.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 25th May 2016 16:22
Quote: "you kill them by jumping on their heads, yet they kill you if you are not jumping on their heads at the time, this can be done easily by grabbing the velocity of the object and checking if it has reached its peak value, if so then it must be falling!"

Or you can just check to see if a collision occurs on the top of the enemy?

Login to post a reply

Server time is: 2024-11-25 05:20:24
Your offset time is: 2024-11-25 05:20:24