• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM [SOLVED]phy_position instance not found?

P

Pilocide

Guest
Hi there,

I've just been testing out several things in 1.4. I've noticed that when I assign the phy_position x or y variable to the keyboard_check, it displays the message instance not set before reading it.



I've enabled physics on the player object and I've also created a wall object to simulate collision. However, this message keeps popping up, I've set the physics mask to perfectly surround the sprite but it still doesn't work. Any idea why this is happening?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You may have enabled physics for the object, BUT does it have a fixture assigned to it? If you haven't assigned a fixture either in the IDE or bound a fixture through code, then none of the physics variables will work correctly (if at all).
 
P

Pilocide

Guest
You may have enabled physics for the object, BUT does it have a fixture assigned to it? If you haven't assigned a fixture either in the IDE or bound a fixture through code, then none of the physics variables will work correctly (if at all).
How do I check if I have assigned a fixture or not?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
M

Matt Hawkins

Guest
It's not necessary to use phy_ position _x, you can use obj_player.x to get or set the objects x position.
Having said that it's not a good idea to move physics objects with things like x+= 4 as the physics won't work properly. You should move physics objects with the physics commands eg physics _apply_force
 
P

Pilocide

Guest
Ummm.... You should know if you've applied a fixture! Have you opened the fixture editor? Have you used the physics_fixture_* functions? If the answer to both of those questions is "no" then you haven't created a fixture for the instance... ;)

Check up on using physics in the manual:

Object Editor: https://docs.yoyogames.com/index.html?page=source/dadiospice/001_advanced use/more about objects/physics.html
Functions: https://docs.yoyogames.com/index.html?page=source/dadiospice/002_reference/physics/index.html
Figured it out, I didn't enable physics in the room itself. (Silly Me!). Thanks for the help :)
 
P

Pilocide

Guest
It's not necessary to use phy_ position _x, you can use obj_player.x to get or set the objects x position.
Having said that it's not a good idea to move physics objects with things like x+= 4 as the physics won't work properly. You should move physics objects with the physics commands eg physics _apply_force
I enable physics because it gives precise collisions.
 
Top