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 / SetObject3DPhysicsSleepingThreshold()

Author
Message
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Mar 2017 19:21
Please can someone explain what this actually means?
I take it to mean how aggressively the object is deemed to be asleep, but what are the value ranges and what is the default value, etc.?
Is the effect logarithmic or linear?

I've tried a number of values and get confusing results such as things stopping in mid fall.
In fact, quite a lot of the 3D physics commands have quite vague help and I can only assume people will be put off trying to figure some of this out.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Mar 2017 19:46 Edited at: 20th Mar 2017 19:56
at very small velocity/movement or rotation it stops and goto sleep mode, means it save cpu time because less calculations.

see default here
GetObject3DPhysicsAngularSleepingThreshold ( objID )
GetObject3DPhysicsLinearSleepingThreshold ( objID )

the result you can see good if you stack some cubes at one plane(ground).

this Threshold value is more a yes/no switch.

you have the freedom to overwrite real world values, so the result is non real.
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Mar 2017 23:53
Hi Markus,

Of course, my primary reason for understanding this is to save CPU time on un-needed physics calc

So, you say it's like a yes/no more like a boolean on/off so why a float value? What does it mean?

Does it mean between 0 and 1 ? What are the upper and lower values and in relation to what exactly?

So I guess you must have had a play with this to understand it, so what does the default GetObject3DPhysicsAngularSleepingThreshold ( objID ) return in relative terms?

At least some of the default physics values appear to be set by size/mass of the object, but it would be good to know the rules which govern this.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Mar 2017 00:52 Edited at: 21st Mar 2017 00:55
it belongs Angular or Linear velocity.
acceleration depends on mass and force.

just print values at screen, you can use Str(float value,decimal places)
GetObject3DPhysicsAngularVelocityX ( objID )
GetObject3DPhysicsAngularVelocityY ( objID )
GetObject3DPhysicsAngularVelocityZ ( objID )
GetObject3DPhysicsLinearVelocityX ( objID )
GetObject3DPhysicsLinearVelocityY ( objID )
GetObject3DPhysicsLinearVelocityZ ( objID )

SetObject3DPhysicsAngularVelocity ( objID, angX, angY, angZ, initialSpeed )
SetObject3DPhysicsLinearVelocity ( objID, dirX, dirY, dirZ, initialSpeed )
SetObject3DPhysicsMaxLinearVelocity ( objID, maxLinearVelocity )

the Threshold result is like a on/off switch. without objects would fidget.
its like
if abs(velocity) <0.001 then velocity = 0.0

the Threshold value are empirical values
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Mar 2017 08:51
The value is the amount an object must move by per frame to be considered alive.

For example, if the threshold is set to 1.0, and a physics object moves 1.1 units per frame, it's alive. If that movement per frame drops to 0.9, then it will be considered asleep and will no longer be calculated.
Signature removed by mod because it's larger than 600x120... please resize and try again.
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: 21st Mar 2017 14:48
Quote: "The value is the amount an object must move by per frame to be considered alive.

For example, if the threshold is set to 1.0, and a physics object moves 1.1 units per frame, it's alive. If that movement per frame drops to 0.9, then it will be considered asleep and will no longer be calculated."


Where are you getting this information from?

SetObject3DPhysicsSleepingThreshold() function takes a linear and angular velocity as floats.

When the objects linear and angular velocity drops below the threshold the object is put in sleep mode by the Bullet Physics engine.
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: 21st Mar 2017 15:12
Which is pretty much what I said, but more technical.
Signature removed by mod because it's larger than 600x120... please resize and try again.

Login to post a reply

Server time is: 2024-04-24 14:32:08
Your offset time is: 2024-04-24 14:32:08