package push{
function Armor::onCollision(%this, %obj, %col, %thing, %other){
if(%col.getDatablock().getName() $= "WCubeVehicle"){
%start = %obj.getEyePoint();
%end = vectorAdd(vectorScale(vectorNormalize(%obj.getEyeVector()), 5), %start);
%vehicle = ContainerRayCast(%start, %end, $TypeMasks::VehicleObjectType);
if(%vehicle){
if(%vehicle.getDatablock().getName() $= "WCubeVehicle"){
echo(%obj.getVelocity());
%col.setVelocity(%obj.getVelocity());
}
}
}
parent::OnCollision(%this, %obj, %col, %thing, %other);
}
};
activatePackage(push);
I'm trying to make it so when you walk into the weighted companion cube you push it in direction you're trying to walk but that doesn't want to let you push it.
The raycast is there to make it so you can only push it if you're facing it.