Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I know this feature is present in the" object or person controlled by keyboard " behavior. But I want to create it myself with coding. How? |
||||
|
Hello, Alireza, I am also concerned by that matter for my project "Copperghinator". That's why I spent my day to create a good demo showing the process of constant speed, acceleration and deceleration. Here is the link to the zipped folder uploaded on my OneDrive (secured and anonymous access : https://1drv.ms/u/s!AjokN1FU3jK1... ). The zipped file contains the .CCB and the .EXE files relative to that demo. The key "Up arrow" accelerates the speed of the cube01. The key "Down arrow" decelerates the speed of the cube01. The limits of the covered distance is 150 decimeters in the positive Z direction and is -50 decimeters in the negative Z direction of the cube01. If the speed of the cube01 becomes negative then it runs towards the negative Z direction. When the cube01 or the cube02 reaches the positive or the negative limits then it automatically returns to their start point. I must admit that it was not easy to create that demo and I hope that it works correctly and that it could help understanding the speed and acceleration of a mobile. COMMENT EDITED ON THE SAME DAY (2021-May-1st - 10PM ) : There was a mistake in the message relative to the "current speed of the cubes". The units are "dm (decimeters)" and not "mm (millimeters)". I just replaced the previously uploaded zip file by a new one. I am sorry for that mistake. |
||||
|
thank s a lot dear marcw. I download your demo. it is very very useful for me. In addition to acceleration, I also needed a speedometer, which I found in your file. The speedometer is very important for my project. The amount of controllability of the car and the amount of damage during an accident and collision with a pedestrian, etc., all depend on speed. |
||||
|
Hello Alireza, I am very glad to read your pleasant comment. As mentioned in my previous comment, converting the equations of acceleration and deceleration into a compact algorithm taking into consideration every delta times and delta speeds was a challenge. Learning mathematics and physics with CopperCube is intellectually enjoyable. About the speedometer for your project, I may imagine that you could create an analog version with a rotating needle. Anyway I wish you all the best with the development of your very interesting project. ![]() |
||||
|
I create ccb files for moving any vehicle very smooth without javascript only with built-in variables. Its a little bit messy but its works perfect. |
||||
|
Hi adteam43, I have no idea how you made acelleration only with variables. Do you have the file with example? I would like to see. Thanks! |
||||
|
Post your email to send the files. Its very easy to do this but its very complicated also. Because its only variables and not a script. |
||||
|
wrote: Hi adteam43, I have no idea how you made acelleration only with variables. Do you have the file with example? I would like to see. Thanks! You can use variables to do something basic like... when "accelerate" key is pressed, +1 to {}car.movementspeed when "brake" key is pressed, -1 to {}car.movementspeed If {}car.movementspeed >100 , {}car.movementspeed =100 If {}car.movementspeed <1 , {}car.movementspeed =0 You can then add more variables to add complexity. |
||||
|
Hi adteam43, my e-mail to send the file: andrewqi_@hotmail.com Thankyou so much! |
||||
|
Ok I prepare the files (full test multiple files) and I will send it to you. When I send I leave message here. |
||||
|
andgameplay i send you the files just now in your email. also with instructions. if you receive it and study my files feel free to share your thoughts with the rest of the members here. Thank you |
||||
|
@adteam43 would you mind to share this solution? Thanks |
|