You are not logged in.
Pages: 1
this is the same thing as instance_place, but works in 3d.
plz critique it all over.
//
// Usage:
// i=d3d_instance_place(x,y,z,par_solid);
//
// Arguments:
// x
// y
// z
// obj
//
// Returns:
// the id of the instance of type obj met when
// the current instance is placed at position (x,y,z).
// obj can be an object or the keyword all. If it
// does not exist, the special object noone is returned.
//
// slayer 64
//
var nn;
while(1)
{
nn=instance_place(argument0,argument1,argument3);
if nn=noone
{
break;
}
if argument2+height-1>nn.z
if argument2<nn.z+nn.height-1
{
break;
}
nn.x+=room_width;
ds_list_add(global.list,nn);
}
repeat(ds_list_size(global.list))
{
with(ds_list_find_value(global.list,0))
{
x-=room_width;
ds_list_delete(global.list,0);
}
}
return nn;
Last edited by slayer64 (2009-07-02 20:35:25)
Offline
Sorry, but I believe this one wouldn't work properly if there is more than one object at "argument0,argument1" . I think instance_place_list(x,y,obj) could be used to your scripts benefit to check which solid's "zz+height" is closer to the player's zz. Just a suggestion.
Offline
This is useful, but it shouldn't be called place_meeting_3d or anything resembling place_meeting, rather it should named after instance_place, upon which it appears to be modeled; place_meeting returns true or false, not an instance id.
Not sure the description is correct. Doesn't this find any instance, not just solid ones?
Sorry, but I believe this one wouldn't work properly if there is more than one object at "argument0,argument1"
I think it would work exactly the same as the other collision check functions, returning the id of the first (and not necessarily closest) instance found, if any. That said, another version that can return a list of instances, maybe even sorted by distance, would also be welcome.
Abusing forum power since 1986.
Offline
BUMP!
i re-made the function. i couldn't re-name the topic name.
plz try to improve it.
Offline
Pages: 1