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 / [SOLVED] Sprites with physics doing strange things during collisions

Author
Message
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 03:07
Some sprites with physics look like this during collisions



there is no special code for both objects

just these physics commands


both objects are dynamic


The author of this post has marked a post as an answer.

Go to answer

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 06:56 Edited at: 20th Feb 2020 07:22
how are you moving the dynamic object ?

My understanding is
that static objects you cant move once set to static
dynamic objects you have to use the physics move commands to move
and kinematic you can set the object positions after the physics set
kinematic objects will ignore static objects and only collide with dynamic objects

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 14:56
I'm moving them with the command SetSpritePhysicsVelocity
But. There is no key input in the gif.

The sprites are resting and clipping each other.


this is an example of the code I made now to show what is happening



fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 15:58
Order is important SetSpritePosition(2, 600, 500) should be before SetSpritePhysicsOn(2, 2)

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 16:04
yes, but the problem remains
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 16:06 Edited at: 20th Feb 2020 16:11
not if you lower the gravity the gravity is set so high its counteracting the bounce off the bottom object
I set setPhysicsGravity(0, 100) and its fine

Edit if you want the gravity to be that high you have to make the mass of the object to be high aswell

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 16:25
ohh, yeah, that makes sense.

But my problem now is that the physics are slower and StepPhysics() seems to do nothing in this case
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 16:28
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 17:05 Edited at: 20th Feb 2020 17:09
is there any way to apply air resistance?

so that objects have different behaviors and speeds in gravity



SetPhysicsScale with low values ​​does this
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 20th Feb 2020 20:56
This post has been marked by the post author as the answer.
is this what you are after


fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 20th Feb 2020 21:26
yes, I think I already understand what I was doing wrong.


I’ve been doing a lot of topics on physics because I'm trying to better understand how the engine works on physics.


I've also been trying to make a system of destruction, and I will probably make a topic of it
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 20th Feb 2020 23:27
I have found that you need to set the virtual resolution small to get fast moving objects.
If you look at the ball collision example i posted in the other thread the virtual resolution is half the window size.
brunuu
5
Years of Service
User Offline
Joined: 4th Jun 2018
Location:
Posted: 21st Feb 2020 00:36
I hadn't noticed that.


but small resolutions for what I'm doing can be a problem.
I need to do some tests.

Login to post a reply

Server time is: 2024-04-25 05:22:52
Your offset time is: 2024-04-25 05:22:52