AligntoVector problems
Blitz3D Forums/Blitz3D Programming/AligntoVector problems
| ||
The past few weeks, I've been using the AligntoVector. It had solved various problems. However, a new problem cropped up. While AligntoVector is really useful and wonderful, Really weird things had been happening. To start this off, yes, I could go up loops now but I could go up walls if I get too close to them. I've been trying many remedies to fix this up but none of them worked. I want it so that if AligntoVector is going to change dramatically, like going up walls all of a sudden, it will be stopped. It's really annoying because the player could easily reach the end of the stage easily with this glitch The following is the code I use; TFormVector 0,10,10,player,0 LinePick(EntityX(player,True),EntityY(player,True),EntityZ(player,True),TFormedX(),TFormedY(),TFormedZ()) AlignToVector player,PickedNX(),PickedNY(),PickedNZ(),2,1 If anybody would be able to answer, I'd be so happy ^.^ |
| ||
You need to check the slope of the surface that is being aligned to if you don't want the user to be able to go up slopes above a certain gradient. The picked normal commands will help with that. In particular checking the pickedny if it is greater or less than a particular value (your choice). |
| ||
You need to check the slope of the surface that is being aligned to if you don't want the user to be able to go up slopes above a certain gradient. The picked normal commands will help with that. In particular checking the pickedny if it is greater or less than a particular value (your choice). So, it would be something like; If PickedNX - EntityYaw(player) =< 45 Then AlignToVector ... ;The code EndIf Or does it need to refer to something else? Because it seems to do it based on the X, Y, Z axis and not rotation - unless there's some ironic naming process. |
| ||
If PickedNX() - EntityPitch(player) <= 45 Then AlignToVector ... ;The code EndIf |
| ||
The collision normal is perpendicular the surface of the "collided with" entity, and is a unit vector which means the length is 1. The vector (nx,ny,nz) makes certain angles with x,y,z axes. The values nx,ny,nz are the cosines of those angles. For example, let's say the collided entity is the ground and is perfectly horizontal. In that case the normal will be (0,1,0) and points in the same direction as the y-axis. The angle between the normal and the y-axis is zero degrees. Notice ny=1 is the cosine of zero. The angle with x-axis or the z-axis is ninety degrees and Cos(90) is 0. Of course, these are floating point values and are approximate. In my example ny might really be something like 0.999999 rather than 1. |