Traceline speed
-
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
Traceline speed
Is it possible to control the speed of a traceline? Or are they instant point a, to point b?
Re: Traceline speed
just look at the builtin definition. if you did, you'd realise that there's no way to specify a velocity/speed/time/etc.
-
- Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Contact:
Re: Traceline speed
Thanks. I was just making sure
Re: Traceline speed
you could always trace after a delay to imitate bullet travel speed
Re: Traceline speed
Traceline is instant: it has to be because it's used (internally, but indirectly*) for collision detection of moving objects.
The way traceline is used is to do a trace for the distance the object will move in one frame. There is no speed limit in quake's physics**, so if you want to have a non-instant but very fast bullet, just set the bullet's speed to something appropriate and let the physics engine take care of everything (cloning the nail code is a good start).
The reason traceline is used for collision detection is to avoid the issue of a fast moving object missing just because its per-frame position never hits the target. Unfortunately, quake does not do it both ways, so two fast moving objects will miss even when they shouldn't, but for one fast and one slow (or both slow), it will work.
* Actually, traceline isn't used, but rather the code for which traceline is a wrapper is used, so it's effectively the same thing.
** Mostly. There is one, but it's caused by the precision of floats so it's pretty high.
The way traceline is used is to do a trace for the distance the object will move in one frame. There is no speed limit in quake's physics**, so if you want to have a non-instant but very fast bullet, just set the bullet's speed to something appropriate and let the physics engine take care of everything (cloning the nail code is a good start).
The reason traceline is used for collision detection is to avoid the issue of a fast moving object missing just because its per-frame position never hits the target. Unfortunately, quake does not do it both ways, so two fast moving objects will miss even when they shouldn't, but for one fast and one slow (or both slow), it will work.
* Actually, traceline isn't used, but rather the code for which traceline is a wrapper is used, so it's effectively the same thing.
** Mostly. There is one, but it's caused by the precision of floats so it's pretty high.
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
Re: Traceline speed
BTW, it is possible to get the quake engine to handle collision between very fast objects, but it would take engine hacking and may not be worth the trouble (it might be too expensive):
- Create hulls representing the paths of traced by all moving objects for the current frame (ie, the hull for a moving object represents the path it traces in this frame). This hull would be clipped against the world.
- Test each pair of hulls for mutual intersection and for each intersection, find the times of "impact" of the two objects owning the hulls. There wil actually be two times for each object: the time where the first object first touches the second object's trace-hull, and the time where the first object last touches the second object's trace-hull.
- If the "impact" time spans overlap, then the objects collide, otherwise they miss. It should be possible to play with the time spans (along with other available information) to get the exact time of impact.
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
Re: Traceline speed
once someone gave me some qc that made the nail gun work off of traces lines. maybe you could spawn a null entity and have the trace follow the front of it instead?