Shooting Player Away from wall in direction

Author Topic: Shooting Player Away from wall in direction  (Read 1169 times)

How do i get it if you teleport in a wall it shoots you in the direction you're in? Thanks!


Quote
%player.setVelocity(vectorScale(%player.getForwardVector(),How much you want to shoot them by));

Don't know how to check if they're in a wall.

The problem is checking if you are in a wall or not. That, I do not know how to do.

%player.getHackPosition() returns the center of the player's collision box.  From there, you could just use a box search to see if the collision box is inside an interior.

%player.getHackPosition() returns the center of the player's collision box.  From there, you could just use a box search to see if the collision box is inside an interior.
Uh, could it work with bricks? How do I get it to get what the player is in?

You'd have to run a box search with multiple type masks (interiors, bricks, etc).

I've never been able to figure it out either, don't worry. :D

Well, you need to know the area to search.  Here's how you find the minimum and maximum points of a player's collision box:

Code: [Select]
%boxMax = vectorAdd(%player.getHackPosition(),vectorScale(%player.getDataBlock().boundingBox,1/8));
%boxMin = vectorSub(%player.getHackPosition(),vectorScale(%player.getDataBlock().boundingBox,1/8));

Then you need to know where to start the search:

Code: [Select]
%pos = %player.getHackPosition();
Then you need to know the size of the box:

Code: [Select]
%width = mAbs(getWord(%boxMax,0) - getWord(%boxMin,0));
%length = mAbs(getWord(%boxMax,1) - getWord(%boxMin,1));
%height = mAbs(getWord(%boxMax,2) - getWord(%boxMin,2));
%box = %width SPC %length SPC %height;

Then you need to perform your search:

Code: [Select]
initContainerBoxSearch(%pos,%box,$TypeMasks::FXBrickObjectType | $TypeMasks::InteriorObjectType);

while (%checkObj = containerSearchNext())
{
     //Add desired code here.
}

See?  It's not that bad.
« Last Edit: December 19, 2007, 05:05:16 PM by Trader »

Well, you need to know the area to search.  Here's how you find the minimum and maximum points of a player's collision box:

Code: [Select]
%boxMax = vectorAdd(%player.getHackPosition(),vectorScale(%player.getDataBlock().boundingBox,1/8));
%boxMin = vectorSub(%player.getHackPosition(),vectorScale(%player.getDataBlock().boundingBox,1/8));

Then you need to know where to start the search:

Code: [Select]
%pos = %player.getHackPosition();
Then you need to know the size of the box:

Code: [Select]
%width = mAbs(getWord(%boxMax,0) - getWord(%boxMin,0));
%length = mAbs(getWord(%boxMax,1) - getWord(%boxMin,1));
%height = mAbs(getWord(%boxMax,2) - getWord(%boxMin,2));
%box = %width SPC %length SPC %height;

Then you need to perform your search:

Code: [Select]
initContainerBoxSearch(%pos,%box,$TypeMasks::FXBrickObjectType | $TypeMasks::InteriorObjectType);

while (%checkObj = containerSearchNext())
{
     //Add desired code here.
}

See?  It's not that bad.
Heh, thanks.