Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So I remember there was a Script by Sven and it was a car script and I just haven't been able to get that working do any of you guys know how to create a car? that isn't just move by keyboard? my problem with that specifically is that It rotates when you don't want it to |
||||
|
Hi carguy, you can try the Sm car behavior, this behavior is a script for cars, and dont rotate when the car is stoped. Use WASD to move the car: https://drive.google.com/file/d/... Don't forget to show us in the forum your car game when you made it! |
||||
|
If you can't get it working, I think you can also achieve do this without a script... if you want to prevent rotation in the move by keyboard behaviour, simply set the rotation speed to =0. Then use variables to trigger the rotate action for the car node. Obviously with rotation_speed set to =0, the car wont turn any more (even when moving), so just add the following actions: When W is pressed, Set variable "W"=1 When S is pressed, Set variable "S"=1 When W is released, Set variable "W"=0 When S is released, Set variable "S"=0 When A is pressed, Set variable "A"=1 When D is pressed, Set variable "D"=1 When A is released, Set variable "A"=0 When D is released, Set variable "D"=0 //This sets variable states, when the keys are pressed Now add the following behaviours: Every few seconds (30ms): If variable "W"=1, If variable "A"=1, If variable D=0, rotate car_node (rotate by rotation), value: 0,-1,0 If Variable "W"=1, If variable "A"=0, If variable "D"=1, rotate car_node (rotate by rotation), value: 0,1,0 If variable "S"=1, If variable "A"=1, If variable D=0, rotate car_node (rotate by rotation), value: 0,1,0 If Variable "S"=1, If variable "A"=0, If variable "D"=1, rotate car_node (rotate by rotation), value: 0,-1,0 //This triggers actions, depending on the variable states Now (I think), the car should rotate only when moving forwards or backwards - and it will steer left and right depending on whether it's going forwards or backwards. I haven;t checked it - so if I get time today, I'll see if it works properly, then I'll upload my car controller and drop a link here for you to look at. |
||||
|
@andgameplay it worked thanks @vp I appreciate the suggestion |
||||
|
|