View Full Version : canPlaceSentry()
RobsoN
29th October 2013, 20:27
Hello, I'm reworking my sentry gun to cod mw2 + style. How can I check whether the turret is in the wall or located in the wrong place (red/yellow model thing)? Should I use 3 bullettrace to check collision with x y z axis? Have you any better ideas?
Regards, Robson.
serthy
29th October 2013, 21:32
either that or play around with physicstrace() & positionwouldtelefrag()
RobsoN
31st October 2013, 22:25
Can you explain a bit how does "physicstrace" work and how can I use it?
vanfreddy
1st November 2013, 01:25
hi here this is an example
deploy()
{
self endon("disconnect");
self endon("death");
angles = self getPlayerAngles();
start = self.origin + (0,0,40) + maps\mp\_utility::vectorScale(anglesToForward( angles ), 20);
end = self.origin + (0,0,40) + maps\mp\_utility::vectorScale(anglesToForward( angles ), 38);
left = maps\mp\_utility::vectorScale(anglesToRight( angles ), -10);
right = maps\mp\_utility::vectorScale(anglesToRight( angles ), 10);
back = maps\mp\_utility::vectorScale(anglesToForward( angles ), -6);
canPlantThere1 = BulletTracePassed( start, end, true, self);
canPlantThere2 = BulletTracePassed( start + left, end + left + back, true, self);
canPlantThere3 = BulletTracePassed( start + right , end + right + back, true, self);
if( !canPlantThere1 || !canPlantThere2 || !canPlantThere3 )
{
return false;
}
trace = bulletTrace( end + (0,0,100), end - (0,0,300), false, self );
if(trace["surfacetype"] == "default" || trace["surfacetype"] == "none")
{
return false;
}
return true;
}
serthy
1st November 2013, 08:29
physicsTrace() is a volume trace that checks against the players volume
Tally
1st November 2013, 09:30
Can you explain a bit how does "physicstrace" work and how can I use it?
physicstrace ignores players on a server. It is better for returning a vector than bullettrace is.
Tally
1st November 2013, 09:31
physicsTrace() is a volume trace that checks against the players volume
No, physicstrace ignores players.
Tally
1st November 2013, 09:33
hi here this is an example
That's bullettrace Pal. Not physicstrace:
PhysicsTrace( <start>, <end> )
Module: Trace
Summary:
Physics trace, ignoring characters. Returns the endpos vector.
Example:
endpos = PhysicsTrace( start, end );
Required Args:
1 : <start> The start point
2 : <end> The end point
serthy
1st November 2013, 10:00
No, physicstrace ignores players.
physicsTrace is just a volume-trace, easier said, it tells you the last possible place between startVec and endVec where a player could stay
Tally
1st November 2013, 10:25
physicsTrace is just a volume-trace, easier said, it tells you the last possible place between startVec and endVec where a player could stay
The script function specifically states: "ignoring characters". Ignoring characters = ignoring players.
serthy
1st November 2013, 10:29
The script function specifically states: "ignoring characters". Ignoring characters = ignoring players.
I dont have any doubts about that =)
Just said that it will return the place where a player could possibly stand -> volumetric trace of the players collision cylinder
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.