ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Cars
person icon
carguy
Guest
Quote
2023-08-02 01:42:14

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

person icon
andgameplay
Registered User
Quote
2023-08-02 03:58:07

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!

person icon
VP
Guest
Quote
2023-08-02 08:03:40

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.

person icon
carguy
Guest
Quote
2023-08-02 20:06:54

@andgameplay it worked thanks

@vp I appreciate the suggestion


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |