• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Changing Physical Position VS Changing Regular Postion? (SOLVED)

Fixer90

Member
So I've got an object to be moved around via inputs, and this object has physics on and a physics-collision circle as well; it moves based on 2 variables: xspeed and yspeed. How these 2 variables are determined is not important - what is important is this:
Code:
x += xspeed;
y += yspeed;
Code:
phy_position_x += xspeed;
phy_position_y += yspeed;
What's the difference between these two? How will my object act one way in comparison to another way?
 
B

Bayesian

Guest
If I understand correctly when an object has physics enabled x and y are basically read only. You can change them but this won't move the object and will de-sync x and y from phy_position_
 

Jezla

Member
If you're going to move your instances in this fashion, you're better off not using physics. As @Bayesian said, x and y are read-only with physics turned on, and manipulation them (or the physics position) directly breaks the simulation. If you're going to move an instance using physics, apply a force or an impulse instead.
 
Top