Low Level paths.

Topics regarding Scripting with Reality Factory
Post Reply
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Low Level paths.

Post by rgdyman » Tue Aug 02, 2005 12:52 am

I have a question about lowlevel path following.

In the HighLevel there's

RotateMoveToPoint(); // Rotate and Move.

I'm running a script in LowLevel.
When I use FacePoint(); Needless to say this isn't a very smooth rotation. The pawn simply, faces the point. I don't have any animations that need to be played or anything.

What I really would like some help with is :
"How can you make the script return the angles the ScriptPoint is facing then have the Pawn ChangeYaw() and keep moving forward to that angle.

Thanks!
rgdyman

Guest

Post by Guest » Wed Aug 03, 2005 9:23 pm

The new RF should have a low level command called:

GetYawToPoint();

This will return the yaw so that you can then use:

self.ideal_yaw=GetYawToPoint();
ChangeYaw();

In case it is not in the latest RF, here is the code:

Code: Select all

	//GetYawToPoint
	case 130 :
	{
		geVec3d Pos, Orient, Play;

		Play = CurrentPoint;
		CCD->ActorManager()->GetPosition(Actor, &Pos);
		geVec3d_Subtract(&Play, &Pos, &Orient);
		float l = geVec3d_Length(&Orient);
		if(l > 0.0f) 
		{
			float x = Orient.X;
			Orient.X = (float)( GE_PI*0.5 ) - 
				(float)acos(Orient.Y / l);
			Orient.Y = (float)atan2(x , Orient.Z ) + GE_PI;
			CCD->ActorManager()->GetRotate(Actor, &Pos);
			while(Pos.Y<0.0f)
			{
				Pos.Y+=(GE_PI*2);
			}
			while(Pos.Y>=(GE_PI*2))
			{
				Pos.Y-=(GE_PI*2);
			} 
		}
		returnValue = Orient.Y;
		return true;
	}
Enjoy.

rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Post by rgdyman » Thu Aug 04, 2005 12:29 am

:oops: LOL

Thanks!! "Guest"

Yes, The command is in there.

Just when I thought I have tried every combanation that there is...

Thanks again!!

rgdyman

Just ran it through. Works Perfect!! ( Now I need to adjust the Path angles)
:wink:

Post Reply