car Angles

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

car Angles

Post by jonas » Thu Aug 04, 2005 6:39 am

:D I know you guys are probably sick of me asking question about getting in cars and driving them and stuff! But I still need to know another thing, :) How can I set the gen1car script to were if the road slants up it doesn't just keep going straight and plow throught the concrete, but goes up!
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack

hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 » Sat Aug 06, 2005 3:14 am

Pickles made a game called O.G.R.E. that had
the vehicles going up hills. If you can find the
game, study the scripts. They say the vehicles go up ramps, but the player viewpoint doesn't change, my car just stops at ramps.

Guest

Post by Guest » Sat Aug 06, 2005 6:01 pm

This is the function from ogre that handled the terrain folowing for the tanks...

Like anything done in an RF game, it is a hack. It simply tests to see whether or not the tank is going up or down and then tilting the tank either up or dwn to match. THe trick is that the level must be made with a Y value that is positivie. (ie, it must be built above 0 Y)

However, the same thing can be done nowadays with a single command if anyone wished to add it. All it would have to do is perform collison test from each corner of the bounding box and then align itself to match the required angle. Anywyas here's the funtion from the original OGRE script from the tanks.

Code: Select all

CheckAngles[()
{
	if(self.current_Y != LASTPITCH)
	{
	debug(DIR);
		switch(DIR)
		{
			case 0
			{
				if(self.current_Y > LASTPITCH)
				{
				self.ideal_pitch=(15)*0.0174532925199433;
				}
				else
				{
				self.ideal_pitch=(-15)*0.0174532925199433;
				}
			}
			
			case 90
			{
				if(self.current_Y < LASTPITCH)
				{
				self.ideal_pitch=(15)*0.0174532925199433;
				}
				else
				{
				self.ideal_pitch=(-15)*0.0174532925199433;
				}
			}

			case 180
			{
				if(self.current_Y > LASTPITCH)
				{
				self.ideal_pitch=(-15)*0.0174532925199433;
				}
				else
				{
				self.ideal_pitch=(15)*0.0174532925199433;
				}
			}

			case 270
			{
				if(self.current_Y > LASTPITCH)
				{
				self.ideal_pitch=(-15)*0.0174532925199433;
				}
				else
				{
				self.ideal_pitch=(15)*0.0174532925199433;
				}
			}
		}
	}
	else
	{
	self.ideal_pitch=0;
	}
LASTPITCH=self.current_Y;
ChangePitch();
}]

User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas » Sat Aug 06, 2005 10:26 pm

Does guest know were I might be able to get a hold of O.G.R.E? :roll:

thanks for the info! :D
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack

Guest

Post by Guest » Sat Aug 06, 2005 10:31 pm

I'm sorry that I haven't had the demos online since the recent changes, but I will get them online this week and then kindly ask Quest to post a link in the demos section. Again, sorry about that folks.

User avatar
jonas
Posts: 779
Joined: Tue Jul 05, 2005 5:43 pm
Location: Texas, USA
Contact:

Post by jonas » Sat Aug 06, 2005 10:33 pm

That would be great! I'm glad that the demo are finally coming back! I was kinda worried that they would be back but I guess I'm just crazy!
Jonas

Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack

User avatar
ZenBudha
Posts: 285
Joined: Wed Aug 17, 2005 6:06 am
Contact:

Post by ZenBudha » Mon Sep 05, 2005 9:50 pm

Another method might be by using 2 pawns for the front and rear tires. Having them check their angles to each other, and then having the car body as the third pawn. It checks the angles between the two pawns, and set it's angle (or pitch) accordingly.

Kind of like having the back tires pawn constantly adjust it's pitch to aim at the front tires pawn. Then having the car body pawn setting it's angle to match the back tires pawns angle.

This way the car will always match the terrain pitch exactly. Could even use 4 pawns 1 for each tire to get side to side tilting as well.

hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 » Mon Sep 05, 2005 11:23 pm

http://www.mapvault.com/uploads/rf/


While you're waiting for OGRE, you can get RF fighting demo,
fif_setup.rar, and operation spyerwolf, and brawl, 4 of Pickle's games, not to mention my personal favorite

http://asylum.rfactory.org/asylumdemo.exe

Post Reply