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 teleport physic objects to a new XYZ location?

Author
Message
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 6th Oct 2018 16:32
I created some objects, gave each of them a Create3DPhysicsDynamicBody, and connected them with joints.

Now I wanted to just place this bunch of object at a new XYZ position, using setObjectPosition() for each of them.

But when I enable Step3DPhysicsWorld(), they just snap right back to the position where I created them.

Is there any smart hack to get this stuff to work?
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 6th Oct 2018 16:51 Edited at: 6th Oct 2018 16:57
I think I had this issue a while back.
I checked the project where I encountered this and it appears I made a deletejoint and/or physics body function for when you wanted to reset an object / object tree.
I also seem to recall posting something about it on here because (maybe it was fixed...) deletejoint didn't work once. I'll have a quick check

This thread was the one I recalled.

Actually, the issue was with getPhysicsJointExists. May have been fixed? But I think I had to to basically "de-physics" the object to move it like this.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 7th Oct 2018 05:16
have you tried Create3DPhysicsKinematicBody(id)

that allows movement and other physics objects to react with it
fubar
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 7th Oct 2018 09:40
Yeah, but then it won't react to gravity and other forces. Create3DPhysicsKinematicBody(id) doesn't seem to create physic object as such - I mean, they don't react to physics at all. I see them more as an interpreter which you use to influence other physic objects.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 7th Oct 2018 10:38 Edited at: 7th Oct 2018 15:58
Other than that dynamic objects should work but you have to set there other settings because they will be effected by objects
I did it that way in the book of portals for the walls that went up and down the movement worked fine but it was effected by
other objects which I didn't want for the walls but I think it should work with set object position you may have to adjust the other
settings such as mass and restitution not sure if those are the ones but im sure ive moved physics dynamic objects with set
position before. It may be a collision or gravity that's infact moving it back

Edited
I think you have to

fubar
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 13th Oct 2018 18:58
Quote: "Now I wanted to just place this bunch of object at a new XYZ position, using setObjectPosition() for each of them."


This can only be done when you first switch the physics off per object, then use SetObjectPosition and then turn the physics for the object on. It can't be switched off by turning off the global physics.


Login to post a reply

Server time is: 2024-04-23 19:16:25
Your offset time is: 2024-04-23 19:16:25