Grev77
New member
I have been going round and round but still cannot rotate an external part of my ship based on the level of the main throttle.
So far I have set a key press to trigger the animation which tells me that that the animation is working. However, I cant seem to get the part rotate using the main engine level to determine the angle, ie: more throttle = larger angle.
here's the code:
I also tried the following code in the same area (with no luck):
And this is what I have in the clbkPostStep area. I placed this so I can test if the enginePart animation works, and it does:
And finally, the DefineAnimation code:
Any suggestions would be great as I have come upon a bit of a roadblock.
Again, what I'm trying to do is animate (rotate) an external part of the ship based on the thrust level of the main engine
Thanx
Grev
So far I have set a key press to trigger the animation which tells me that that the animation is working. However, I cant seem to get the part rotate using the main engine level to determine the angle, ie: more throttle = larger angle.
here's the code:
Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] Pegasus::AnimateEnginePart (PartStatus action)[/COLOR][/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i = 0; i < 2; i++)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] level = GetThrusterLevel (th_main);[/SIZE]
[SIZE=2]UINT pos = (UINT) (level *500.0);[/SIZE]
[SIZE=2]SetAnimation(anim_enginepart, level);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
I also tried the following code in the same area (with no luck):
Code:
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]if (pos != engsliderpos)[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]{[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]SetAnimation(anim_enginepart, level);[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]engsliderpos = pos;[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]}[/COLOR][/SIZE]
[/COLOR][/SIZE]
And this is what I have in the clbkPostStep area. I placed this so I can test if the enginePart animation works, and it does:
Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] (part_status >= PART_CLOSING) [/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// Animate Engine part[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] da = simdt * PART_ROT_SPEED;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (part_status == PART_CLOSING) [/SIZE]
[SIZE=2]{ [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (part_proc > 0.0) part_proc = max (0.0, part_proc-da);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] part_status = PART_CLOSED;[/SIZE]
[SIZE=2]} [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2]{ [/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (part_proc < 1.0) part_proc = min (1.0, part_proc+da);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] part_status = PART_OPEN;[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]SetAnimation (anim_enginepart, part_proc);[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//AnimateEnginePart (part_proc);[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]}[/SIZE]
And finally, the DefineAnimation code:
Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]static[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] UINT EnginePartGRP1[1]={2};[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]static[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] MGROUP_ROTATE EnginePart1 (0,EnginePartGRP1,1,_V(5.1826,-0.516f,5.405f),_V(0,0,-0.393),([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]float[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])PI);[/SIZE]
[SIZE=2]anim_enginepart = CreateAnimation (0.0);[/SIZE]
[SIZE=2]AddAnimationComponent (anim_enginepart, 0.0f, 1.0f, &EnginePart1);[/SIZE]
Any suggestions would be great as I have come upon a bit of a roadblock.
Again, what I'm trying to do is animate (rotate) an external part of the ship based on the thrust level of the main engine
Thanx
Grev