Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Here is the code used in the event:
if (physics_test_overlap (phy_position_x, phy_position_y, phy_angular_velocity, object1))
{
phy_active = false;
phy_speed_y = 0;
}
This at least makes the falling object stop falling upon collision; however, I feel there must be a better solution because I do not want to make physics no longer be active - I just want the objects to collide properly. If I comment out that line and simply set the falling speed to 0, however, then the object no longer stops falling; it just slows down but continues to fall right past the floor object. I also looked into physics_collision_x and physics_collision_y, but they only seem useful for finding the position or points of contact for a collision rather than defining how the objects should collide. I'm sure I'm missing something very obvious, but I'm still stumped on this; any help would be appreciated.
When there's an overlap, you need to make y equal to yprevious. That will cause it to return to the last spot it was in before it overlapped.
As far as I know (and I'm not sure, I still haven't done any work with it), the collision event is actually doing absolutely nothing, meaning the overlap check is the only thing determining whether or not it keeps moving because it's a physics check, not a general collision check.
The reason it's falling into the object is that it's not checking for a collision between two objects next to each other. It's checking for a collision between two objects that are currently partially residing in the same space on the coordinate plane. If you set speed to 0, it's still going to be in that same space, because you haven't told it to do anything with the position of the object, you've only told it to stop moving.