Better Helo Cntrol

Blitz3D Forums/Blitz3D Beginners Area/Better Helo Cntrol

Doggie(Posted 2005) [#1]
If KeyDown(200) Then
hspeed#=hspeed#+0.05
If hspeed#>5 Then hspeed#=5
TurnEntity player ,0.25,0,0
EndIf
If KeyDown(208) Then
hspeed#=hspeed#-0.05
If hspeed#<-2.0 Then hspeed#=-2.0
TurnEntity player ,-0.25,0,0
EndIf


If KeyDown(203) Then
TurnEntity player ,0.25,3,0
EndIf

If KeyDown(205) Then
TurnEntity player ,-0.25,-3,0
EndIf
TranslateEntity player,0,0,0
MoveEntity player , 0 , 0 , hspeed#

problem is that the player(helo) doesn't return parallel after turning. I've got the cam entityparented to the player so tilting the player with a rotation screws the pooch. I'm sure this is a no brainer...thanks

The Dog Person


Ross C(Posted 2005) [#2]
I wouldn't use turnentity. Try using rotateentity instead, like so:


RotateEntity entity, EntityPitch(entity)  , EntityYaw(entity), EntityRoll(entity)



Obviously add on or subract the amount you want to turn, like so:


RotateEntity entity, EntityPitch(entity)+1  , EntityYaw(entity), EntityRoll(entity)



I find the way turnentity works, is usually the way ypou don't want it too.

As for your problem, i take it, the entity rolls as it moves?


Doggie(Posted 2005) [#3]
"As for your problem, i take it, the entity rolls as it moves? "

Yeah, but the problem is that it stays rolled instead of returning upright. A helo hangs under the rotors.
That's why I tried to use translateentity to return to 0,0,0 but it doesn't. Also, the collective is controlled seperately but doesn't really apply but just in case anyone wondered.

I tried as you suggested already but that causes the cam to go ballistic and lose sight of the helo.

Thanks!


Ross C(Posted 2005) [#4]
Try a follow cam then.

Have a pivot, parented to your entity, you want the camera to follow. Position the pivot, at the location you'd like the camera to sit, then, every frame, do...

pointentity camera,cam_piv
moveentity camera,0,0,entitydistance#(camera,cam_piv)/100.0; higher / number means slower movement
pointentity camera,entity ; entity, is the one the camera is to look at.


This should cause the camera, to smoothly follow the entity, and turn smoothly too :o)


Ross C(Posted 2005) [#5]
If you need any help implementing it, gimme a shout :o)


Doggie(Posted 2005) [#6]
Actually that makes for a cool effect. It also lets me see
what's wrong a little better. The helo remains pointing downwards...of course this doesn't solve the problem.
What needs to happen is the helo only tilts so long as keydown is pressed then return level...

Edit: Aha! I was changing the pitch instead of the roll on the turns...I'm on the right track now, just got to fine tune it but changing the cam function that you suggested is the best part. Much better now.

Thanks!


Ross C(Posted 2005) [#7]
No, worries :D