Hi Everyone!
I was wondering if anyone had some insight into how I could go about creating a script that returns the id of an object at a point in 3D space. I guess this means I'm essentially looking for a 3D equivalent of instance_place(), if such a thing is possible. I attempted to make a script that would do this (included below), however it doesn't appear to work at all. I'm guessing my code below is probably too basic, but I thought I'd try and cheese it (with no luck).
Any help is greatly appreciated!
I hope you all have a great evening!
I was wondering if anyone had some insight into how I could go about creating a script that returns the id of an object at a point in 3D space. I guess this means I'm essentially looking for a 3D equivalent of instance_place(), if such a thing is possible. I attempted to make a script that would do this (included below), however it doesn't appear to work at all. I'm guessing my code below is probably too basic, but I thought I'd try and cheese it (with no luck).
GML:
///d3d_instance_place_test(x,y,z,target);
var check_x = argument[0];
var check_y = argument[1];
var check_z = argument[2];
var tar = argument[3];
if position_meeting(check_x,check_y,tar)
{
var tar_check = instance_position(check_x,check_y,tar);
if ((tar_check.z <= check_z) && ((tar_check.z + height) >= check_z))
{
return tar_check
}
else
{
return noone;
}
}
else
{
return noone;
}
I hope you all have a great evening!