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 Studio Chat / 3D Physics Hinge Joint Motor

Author
Message
jd_zoo
2
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 3rd Jul 2020 02:35 Edited at: 3rd Jul 2020 02:49
Is there a relationship between the Set3DPhysicsHingeJointMaxMotorImpulse() when creating a hinge joint motor and the Set3DPhysicsHingeJointMotorVelocity() when operating the joint? I approached this as the MaxMotorImpulse being the "ramp" to get to the set velocity.

In the below example the hinge joint motor operates at a velocity of 125 but not 150. I've tried playing around with ratios between the Impulse to Velocity but its not obvious to me whats wrong. Any hints or ideas would be appreciated.

EDIT:
If you change the HingeLimits to -90 and 90 than higher speeds will work. I'm looking for -45 to 45 and very fast switching. Still would appreciate any insight into this...

blink0k
Moderator
7
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Jul 2020 02:59
It appears to be related to the Physics World Scale. It's interesting that 127 is the value it tops out at.
Try this;
< then > then really hammer the arrow keys

I suggest making the models larger but it think you will always run into trouble.
It's broken and it doesn't work
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 3rd Jul 2020 03:20
odd. if you set the hinge limits to ±50, it works as expected.
blink0k
Moderator
7
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Jul 2020 03:32
If you set them to +-60 it doesn't work
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 3rd Jul 2020 03:43 Edited at: 3rd Jul 2020 03:45
actually, i think our expectation/usage is incorrect.

see this and the following modifications to the above code:

blink0k
Moderator
7
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Jul 2020 04:55
Nice work VN
jd_zoo
2
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 3rd Jul 2020 14:36 Edited at: 4th Jul 2020 14:15
Thank you for the replies and I am now looking at this in a different light, however I still cannot get it to work properly. The text from the link provided by VN references the following:

Max Motor Force - I believe this is the Set3DPhysicsHingeJointMaxMotorImpulse() value? Would this be what ties the mass of the object to the amount of rotation in degrees per step?
Target Velocity - I believe this is the Set3DPhysicsHingeJointMotorVelocity() part of our hinge joint? Is this the angle in degrees we want the door to rotate?

Is this how you understand it? I am still leaning on there being a problem with this operation in general and will need to work with the max speeds I can get at a 45deg angle...


EDIT - ok so the problem turned out to be the angle limits. I was using -45 - 45, but changing that to 315 - 45 seems to solve the issue. This is slightly contrary to the documentation that states "To unlock the joint set the lower limit greater than upper limit."
Ont thing of note, you do need to apply a Set3DPhysicsHingeJointMaxMotorImpulse() before the Set3DPhysicsHingeJointMotorVelocity() command will work. So my original approach of the Impulse acting as the ramp-per-step appears to be somewhat correct, although you can get movement from the object by repeatedly applying the Impulse() so more to learn I guess.

Final code here, its flippin' fast now


Login to post a reply

Server time is: 2020-08-04 03:43:26
Your offset time is: 2020-08-04 03:43:26