Dim3 2.2
1). I have a a space ship flying with chase cam from behind, you can switch the cam between chase or fps whilst flying, I've re-mapped q,e keys to make it barrel roll with obj.model.rotate.z = obj.model.rotate.z +5 for instance.
What I need to do is have it so when I hold the key it keeps rolling by 5 degree or whatever increments on the z axis until the key is released. I also need the camera follow with slop.
Anyone have any ideas?
2). I have some weapons on my ship they hit the crosshair bang on in fps cam but in chase cam crosshair is very erratic and can completely leave the screen at times.
3). I'm also looking for a way to make reverse (s key) decelerate instead of causing a dead stop before reversing.
Thanks L
To answer your question backwards:
3. Not defaultly possible in 2.2 (and as far as I know 2.5? maybe?). Theoretically, you could map the S key to a different action. In the player script, you would then set up a very short timer, where every tick it would check if S is pressed. If it is, you would set acceleration to 0 and subtract from the speed a small amount. If it's not pressed, you would set acceleration back to normal.
That might work, you'd have to try it.
2. That's... weird. And probably shouldn't happen. I'm not sure whats going on though.
1. I suppose you could use the same method listed above, except with slightly longer increments perhaps. Each the button is pressed would rotate it by 1ยบ.
... that is, if that method works at all.
For the camera, perhaps the function camera.chase.trackSpeed is what you're looking for?
1. Gordon CSA has it right, but keep in mind that obj.model.rotate.* is only visual, so if you press the "right turn" key when your ship is upside-down you'll actually be turning to the pilot's left.
2. Crosshairs are very, very broken in anything but FPS mode (or at least they were the last time I tried them). Give up on this one until Brian fixes it.
3. You do not need a timer to make an object decelerate. Set "S" to a player key (instead of the reverse key). When you get the key down event, set player.forwardSpeed.deceleration (or .decelerationAir if you're flying) to a high value (so the player slows down faster than normal). When you get the key up event, set the deceleration back to normal.
3. Thanks Cyst, (I was kicking myself of over my misinformation earlier, once I'd actually tried to get my method to work.)
1. The fact that its visual (although it does control the hitbox I believe?) is actually better in my opinion. I'd hate to have to reverse all my controls in my head while flying upside down.
Thanks for the answers guys.
1. I don't only want the model to rotate I want the camera to rotate as well with some slop in chase cam, in FPS cam I need the model and camera in sync. Maybe my rotating the model isn't the right way to go?
2. Will wait on this one.
3. I've got this partially working using the method cyst recommended Thanks!, however once the speed has decelerated to 0 I'm not accelerating backwards because I've removed Action name="move_backward" from Setup.xml. How can I switch that back on when I've reached 0 speed?
1. The actual object z-angle is apparently read-only, but you can still rotate the camera with the player by setting camera.angle.z+=5 (or whatever value you rotate the ship by). The FPP/Chase modes don't ever change the z rotation, so the camera will stay rotated even if you switch camera modes.
3. Moving backwards is tricky -- not impossible, but tricky.
First, in your player construct function, set player.setting.quickReverse=false -- this basically disables the forward/backward keys until your speed is zero. Now, go into the key settings, and set the "S" key as both the player key you created and the move backwards key (you'll have "S" assigned to two actions).
The catch is that you'll have to do the same thing for your forward key, or you won't be able to stop moving backwards. When you're done, your key assignments should look something like this:
<Action name="move_forward" attach_0="W" />
<Action name="move_backward" attach_0="S" />
<Action name="player_0" attach_0="W" attach_1="S" />