physics_fixture_set_restitution

This function sets the restitution value of a fixture.

Syntax:

GML Code Example

physics_fixture_set_restitution(fixture, restitution)


Argument Description
fixture The index of the fixture
restitution The restitution of the fixture (usually between 0 and 1)


Returns: N/A


Description

In physics, restitution is defined as "the return of an object or system to its original state after elastic deformation", but as the fixtures in the GameMaker: Studio are really rigid bodies and cannot be deformed, restitution is really a way of saying how "bouncy" the fixture is. This setting will affect how much an object "bounces" when it collides with other objects and is co-dependant on other forces that act on the instance like gravity and friction, and is usually a value between 0 and 1 (higher values can be used but may give un-predictable results). Here is an illustration of how it works:


Example:

GML Code Example

physics_fixture_set_restitution(fix_Ball, 0.9);

The code above will set the restitution of the fixture indexed in "fix_ball" to 0.9.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here