Jump to content
Sign in to follow this  
scotg

rotation in model.cfg

Recommended Posts

This is the pitch and yaw of a Blackfoot turret:

		class MainTurret
		{
			type="rotationY";
			source="mainTurret";
			selection="turret";
			axis="turret_axis";
			minValue=-6.2831855;
			maxValue=6.2831855;
			angle0=-6.2831855;
			angle1=6.2831855;
			animPeriod=0;
			initPhase=0;
		};
		class MainGun
		{
			type="rotationX";
			source="mainGun";
			selection="gun";
			axis="gun_axis";
			minValue=-6.2831855;
			maxValue=6.2831855;
			angle0=-6.2831855;
			angle1=6.2831855;
			animPeriod=0;
			initPhase=0;
		};

What do the number values represent? It's surely not degrees, so how much of a turn is -6.2831855 for example? I'm assuming that's to the left with the turret axis set up the correct way in the memory LOD... but HOW MUCH to the left? In game, this value appears to be more than 45 degrees to the left, but less than 90. What's the formula?

Share this post


Link to post
Share on other sites

There's 2 pi radians in a full rotation, so 6.28 (3 s.f.).

I'd be surprised if the turret could manage a full rotation in both directions in the Y-axis. ScotG also implies that the turret can't turn more than 90 degrees in either direction, despite these config values. Scot, have you tried changing them and seeing if there's an effect?

Share this post


Link to post
Share on other sites

If you want to write the angles in degrees though you can use the "rad" operator in the model.cfg and it'll convert the value to radians. e.g.

			angle0="rad 0";
			angle1="rad 90"; // max 90 degree turn

The actual angle through which a gunner can turn the turret is defined in the config.cpp though, with the maxTurn and minTurn parameters. Which do use degrees.

Edited by da12thMonkey

Share this post


Link to post
Share on other sites

@Beazley: Yes, I toyed around with some of the values:

I first attempted to give all instances of "6" a value of "9" (and "-6" to "-9") for the turret part itself. I left the numbers below the decimal as is. This worked to some degree, but still less than 180 degree (90 left and 90 right) range.

Second, I bumped up the values to 10 and -10. This caused the turret to be loaded looking backwards. I wasn't sure which lines affect range, or which lines affect starting positions.

I should have stated that this code is being used on my own model, though I borrowed this section from the Blackfoot. I'm not certain how it makes the Blackfoot itself behave, now that I think of it.

@da12thMonkey: I think I will give that a try. Will it work in excess of 90 degrees? I want it to look wherever the operator can realistically see. This turret will eventually utilize TrackIR or freelook.

EDIT: I just caught the last part of what 12th said, and I feel like a buffoon. I have the min/max set to -70/70 in the config. D'oh.

Edited by ScotG

Share this post


Link to post
Share on other sites
@da12thMonkey: I think I will give that a try. Will it work in excess of 90 degrees? I want it to look wherever the operator can realistically see. This turret will eventually utilize TrackIR or freelook.

EDIT: I just caught the last part of what 12th said, and I feel like a buffoon. I have the min/max set to -70/70 in the config. D'oh.

Good that you got it sorted

But to answer your question for the sake of others who might read the thread, or if you need to do it yourself in future: Yes, you can write vales higher than "rad 90" in the model.cfg, you can even write values higher than "rad 360" if you want an object to complete multiple revolutions before the animation source controller reaches its maximum value (for example if you were animating a hand crank or something).

Share this post


Link to post
Share on other sites
There's 2 pi radians in a full rotation, so 6.28 (3 s.f.).

Thanks yes I'm half asleep today!

Share this post


Link to post
Share on other sites

in case of turrets always use (unless you want to make something really special)

			minValue="rad -360";
			maxValue="rad +360";
			angle0="rad -360";
			angle1="rad +360";

The limit for rotation is set in the config of the turret instead.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×