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 do I do linear movement when physics is on?

Author
Message
SmileSlime
7
Years of Service
User Offline
Joined: 10th May 2017
Location:
Posted: 31st Jan 2018 16:52
Since SetSpritePosition is not recommended to use when physics is on, I am not sure how to emulate linear movement via physics commands. I tried various commands like friction, mass, restitution, but the closest thing I could get was a Binding of Isaac-like movement.
I love games, who doesn't?
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 31st Jan 2018 20:58
You could try SetSpritePhysicsVelocity().
SmileSlime
7
Years of Service
User Offline
Joined: 10th May 2017
Location:
Posted: 31st Jan 2018 21:52
It says that it also causes problems with physics when using that command.
I love games, who doesn't?
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 31st Jan 2018 22:08 Edited at: 31st Jan 2018 22:11
No it says that it may not look correct. Like how a ball abruptly changing direction without hitting anything would look weird. But, if you are setting the velocity of the sprite on every frame then the sprite won't slow down or seem to be affected by other physics objects.
SmileSlime
7
Years of Service
User Offline
Joined: 10th May 2017
Location:
Posted: 1st Feb 2018 00:13 Edited at: 1st Feb 2018 00:13
https://www.appgamekit.com/documentation/Reference/Sprite/SetSpritePhysicsOn.htm - From here:

You can also use the SetSpritePhysicsVelocity and SetSpritePhysicsAngularVelocity to change the speed and direction of a sprite, but again these will interfere with the physics motion of the sprite.

Am I seeing this right?
I love games, who doesn't?
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 1st Feb 2018 10:15 Edited at: 1st Feb 2018 10:19
The way it is worded isn't very insightful but they are trying to convey that using those commands to alter the speed and direction of a sprite won't look as natural as using SetSpritePhysicsForce() to accelerate the sprite in a gradual manner.
SmileSlime
7
Years of Service
User Offline
Joined: 10th May 2017
Location:
Posted: 1st Feb 2018 14:22
Quote: "The way it is worded isn't very insightful but they are trying to convey that using those commands to alter the speed and direction of a sprite won't look as natural as using SetSpritePhysicsForce() to accelerate the sprite in a gradual manner. "


I see, thank you for the insight.
I love games, who doesn't?

Login to post a reply

Server time is: 2024-11-24 02:37:52
Your offset time is: 2024-11-24 02:37:52