Author Topic: /Warp on bricks  (Read 1257 times)

Try calculating the brick's height from attributes of its datablock.
I could, but I don't really see why I would do that.


I could, but I don't really see why I would do that.
So you can figure out where its top is. Or you can try posFromRaycast(%ray); or something similar.

Code: [Select]
function serverCmdWarpBrick(%client)
{
if(%client.isAdmin && isObject(%client.player))
{
%raycast = containerRayCast(%client.player.getEyePoint(),vectorAdd(%client.player.getEyePoint(),vectorScale(%client.player.getEyeVector(),200)),$TypeMasks::FxBrickObjectType);
if(isObject(firstWord(%raycast)))
{
%rayPos = posFromRaycast(%raycast);
%playerBox = %client.player.getObjectBox();
%playerScale = %client.player.getScale();
%sizeZ = vectorDist(getWord(%playerBox,2),getWord(%playerBox,5))*getWord(%playerScale,2);
%rayPos = setWord(%rayPos,2,getWord(%rayPos,2)+(%sizeZ/2)+0.1);
%client.player.setTransform(%rayPos);
}
}
}
That should make them not get stuck (if they are landing on a platform or something with nothing above them.