D
DeadZombie
Guest
Hello everyone!
The problem I have faced with is more or less common, but I didn't find any solutions for my case.
I create bullet object and it has a speed. As far as I know, the speed determines the distance in pixels where object would be drown every step. So if the bullet has speed 6, and there is an object in front of it which width is less than 6 pixels, the collision may not be registered, because depending on it's start position bullet may not appear inside of the object and not interact with it.
The second reason why I want to determine collisions precisely is that I don't like decals to be drawn inside of the object bullet interacts with. And every time (depending on start position) collision occurs at different depth. That is how 'Collision Event' works. But I want to register collisions right at the edge of the object.
I use the popular script for this purpose inside bullet's step event:
It works nice. Decals are drawn exactly at the edge of the wall or crate or any other object.
Now I want to use Collision Event inside of object bullet collides with to provide damage script, destroy animation and so on. And guess what? Collision event didn't work. I found that Collision event doesn't detect COLLISION but OVERLAPPING. Which means I need to change my place_meeting script so it provides overlapping. But I don't know how. I've tried to add something like x += 1; after place_meeting returned true, but it's still not working. Decals animation plays deeper in object, so the bullet actually moves inside of it, but the collision event is still not working.
Is anybody aware of this issue?
UPD: The picture as a quick issue guide
The problem I have faced with is more or less common, but I didn't find any solutions for my case.
I create bullet object and it has a speed. As far as I know, the speed determines the distance in pixels where object would be drown every step. So if the bullet has speed 6, and there is an object in front of it which width is less than 6 pixels, the collision may not be registered, because depending on it's start position bullet may not appear inside of the object and not interact with it.
The second reason why I want to determine collisions precisely is that I don't like decals to be drawn inside of the object bullet interacts with. And every time (depending on start position) collision occurs at different depth. That is how 'Collision Event' works. But I want to register collisions right at the edge of the object.
I use the popular script for this purpose inside bullet's step event:
Code:
//Horizontal Collision
if (place_meeting(x+hspeed,y,obj_wall))
{
while(!place_meeting(x,y,obj_wall))
{
x += sign(hspeed);
}
hspeed = 0;
}
x += hspeed;
//Vertical Collision
if (place_meeting(x,y,obj_wall))
{
while(!place_meeting(x,y+sign(vspeed),obj_wall))
{
y += sign(vspeed);
}
vspeed = 0;
}
y += vspeed;
Now I want to use Collision Event inside of object bullet collides with to provide damage script, destroy animation and so on. And guess what? Collision event didn't work. I found that Collision event doesn't detect COLLISION but OVERLAPPING. Which means I need to change my place_meeting script so it provides overlapping. But I don't know how. I've tried to add something like x += 1; after place_meeting returned true, but it's still not working. Decals animation plays deeper in object, so the bullet actually moves inside of it, but the collision event is still not working.
Is anybody aware of this issue?
UPD: The picture as a quick issue guide
Last edited by a moderator: