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.

Author
Message
Jna99
18
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 24th Sep 2011 02:10
Hi,

I'm trying to make an object bounce higher on certain objects, in order to do this I'm setting the SetSpritePhysicsRestitution with a higher value each time theres a colision with this type of objects..unfortunaly nothing is happening when the colision happens is it some kind of bug? can someone please help?



XanthorXIII
AGK Gold Backer
12
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 24th Sep 2011 02:24
I think SetSpritePhysicsRestitution was suppose to be limited to 1.0 as values above can cause issues.
The other thing I noticed is that the second sprite you are colliding with does not have a shape associated with it, that may be causing problems. One other thing you might try is Kinetic for the second Sprite.
These are just suggestions. I'm no expert and still playing around learning how physics work with the AGK.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 24th Sep 2011 02:30 Edited at: 24th Sep 2011 02:57
I don't think you want to increase the restituion, and it looks like you aren't.

You are setting the restitution to 10.0 each time? That is not increasing it.

However, as I understand it, a restitution of 1.0 will bounce an object away at the same speed it hits. When I've increased this value, it only takes a small value to get my sprites moving really quickly, like 1.4, 1.5, etc. The more collisions, the faster the sprite is moving. A value of 10.0 should make the sprite move pretty fast, depending on the scale of your world, sprite mass, etc.

I'm not good enough with C++ to debug your code, but I'll load it into AppGameKit and take a look. Right now, it seems you haven't assigned a shape to sprite 6?

Anyway, I'll give it a try.

EDIT: Hah! Ninja'd by XanthorXIII! Like he said...


Try this in Tier 1, see how the restitution has a large effect at low values over 1.0, and see how the sprite gets erratic when the speed is really fast... I think the speed is capped in there somewhere, but the sprite looks more jerky as the restitution is higher.



More Edit: Ah, good, glad you got it sorted!

Jna99
18
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 24th Sep 2011 02:54
Thanks guys it worked I've set the SetSpritePhysicsOn of sprite 6 to Kinematic and specified a SetSpritePhysicsRestitution!



Login to post a reply

Server time is: 2024-04-24 08:33:05
Your offset time is: 2024-04-24 08:33:05