instance_place not detecting precise collisions

creagan

Member
I have the following piece of code which works in one part of my game without regard to the masks of my objects (I use Precise(Slow) on most of them):

// Test collision with all objects in master list
for (var vt2 = 0; vt2 < all_objects_count; vt2++){
var vobjecthit = instance_place(x, y, all_objects[vt2])
if vobjecthit > 0 {Do such and such}
}

When I use this same code in another part of my game, which is in another room, it will not work unless I make the masks of each of the same objects Automatic/Rectangle or some other imprecise method. I don't understand what the difference could be that would be causing this not to work in the new place.
 
A couple questions: What do you mean by 'it does not work'? Do no collisions happen at all or do they happen incorrectly? I'm also fairly sure that in order for collisions to be precise both objects need to be using precise collisions. If either one is not set to price it uses regular collisions.
 

creagan

Member
Thanks for responding. The vobjecthit variable above does not contain a value that it hit something. In other parts of the game, it returns the object hit. Specifically, vobjecthit returns the keyword "noone" when it is malfunctioning. Both objects being tested have the Precise mask selected.

It's weird. I almost suspect a bug in Gamemaker, but I'm still betting it's something I don't know about.
 

FrostyCat

Redemption Seeker
Does the instance calling instance_place have a collision mask? If it does not, instance_place will always return noone.
 

creagan

Member
You have to finish answering the question if you want anyone to answer yours.
Sorry, I didn't realize I was being vague. I actually went around this issue another way, so I'm going to just "give up" on this solution for now. Thanks for responding. :)
 

creagan

Member
Does the instance calling instance_place have a collision mask? If it does not, instance_place will always return noone.
Yes, all objects involved have a collision mask and actually work in other places! I went around this issue, though, since it seems like it might be a bug. Thank you for responding, though. I appreciate it!
 

creagan

Member
I am closing this thread for now. Might be a Gamemaker bug. Since I am relatively new to the platform, it could easily be a programmer bug, too!
 

Nidoking

Member
The bug is that you don't have the actual instances in your array. If you would bother to explain how you thought you were putting the instances in that array, I would be able to tell you why you're not, but I'm not going to make the effort to guess if you're not going to provide any information. Your workaround is probably better than whatever you were doing, but it is definitely your error, not the program.
 
Top