Page 1 of 1

steering wheel to left and right with bos/cob file

Posted: 08 Apr 2019, 13:48
by Flaka
i want to do an animation for the unit u see in the attached file. i have no experience of this right now. however - i managed to adapt the script of the old model to the new one. wheels are turning quite well. what i want to add now is that the frontwheel is turning in the right direction when the units is moving around. that means turning left a bit when units is turning left, straight when the unit is going straight and so on....

i found a script of the BA minelayer vehicle armmlv where the frontwheels are doing exactly this. but til now i didnt manage it to integrate it to my script. actually wheel is turning somehow - but not doing exactly what i want.
i also havent understood until now how i can set the maximum anglewhere the wheel should stop from further turning. the minelayer should have this also - wheels are stopping after 45° but i cant work it out how it is done. is there someone wo can explain me more about this pls?

steering wheel to left and right with bos/cob file

Posted: 08 Apr 2019, 13:49
by Flaka
i want to do an animation for the unit u see in the attached file. i have no experience of this right now. however - i managed to adapt the script of the old model to the new one. wheels are turning quite well. what i want to add now is that the frontwheel is turning in the right direction when the units is moving around. that means turning left a bit when units is turning left, straight when the unit is going straight and so on....

i found a script of the BA minelayer vehicle armmlv where the frontwheels are doing exactly this. but til now i didnt manage it to integrate it to my script. actually wheel is turning somehow - but not doing exactly what i want.
i also havent understood until now how i can set the maximum anglewhere the wheel should stop from further turning. the minelayer should have this also - wheels are stopping after 45° but i cant work it out how it is done. is there someone wo can explain me more about this pls?

Re: steering wheel to left and right with bos/cob file

Posted: 08 Apr 2019, 13:50
by Flaka
armfav_script.JPG
(64.93 KiB) Not downloaded yet
armfav_animation1.JPG
(73.31 KiB) Not downloaded yet

Re: steering wheel to left and right with bos/cob file

Posted: 08 Apr 2019, 17:50
by Jools
Why attach the script as a jpeg? Attach the code as t̶e̶x̶t̶ png: png is better for things like raster graphics where you have few colors.

Re: steering wheel to left and right with bos/cob file

Posted: 10 Apr 2019, 06:26
by Forboding Angel
Doing this is one of those things that "Sounds cool" but in practice sucks.

Why? Because you're going to get stuck in an arbitrary turnrate that can't be exceeded otherwise what is in your graphic happens. And if you decide to limit it to a certain angle, then it's just going to look silly turning faster than it possibly could with that visual angle.

I believe that the answer to your question is not in your script, but in the unitdef turnrate.

Re: steering wheel to left and right with bos/cob file

Posted: 10 Apr 2019, 12:08
by MasterBel
Forboding Angel wrote: 10 Apr 2019, 06:26 Doing this is one of those things that "Sounds cool" but in practice sucks.

Why? Because you're going to get stuck in an arbitrary turnrate that can't be exceeded otherwise what is in your graphic happens. And if you decide to limit it to a certain angle, then it's just going to look silly turning faster than it possibly could with that visual angle.

I believe that the answer to your question is not in your script, but in the unitdef turnrate.
Surely there's a way to get around those problems that you've listed?

Re: steering wheel to left and right with bos/cob file

Posted: 10 Apr 2019, 23:01
by Forboding Angel
MasterBel wrote: 10 Apr 2019, 12:08 Surely there's a way to get around those problems that you've listed?
Absolutely!
Because you're going to get stuck in an arbitrary turnrate that can't be exceeded otherwise what is in your graphic happens. And if you decide to limit it to a certain angle, then it's just going to look silly turning faster than it possibly could with that visual angle.

Re: steering wheel to left and right with bos/cob file

Posted: 10 Apr 2019, 23:12
by Forboding Angel
Upon further reading of OP, perhaps I should state it thusly...

While limiting the angle will look pretty silly when the unit pulls a hard turn, limiting the angle is as simple as:

if heading > x
heading = y
end

I can't remember if spring angles use negative numbers (I should know this but it escapes me atm). If it does use negative numbers you'll need a statement to limit the negative angle as well.

Re: steering wheel to left and right with bos/cob file

Posted: 14 Apr 2019, 14:08
by Flaka
thanks for the response. actually wheel is turning on and on like a clock - thats looking silly. no wheel turn while unit is steering left and right is also not top of the game. and the wheel turn must fit also to the model of the unit. for that reason i want to limit it. probably i have made sth wrong on my first attempt also cause armmlv is turning wheel like it should without seeing some limit. so i have to look again to understand this topic better and i will try the proposed code soon. thank you.

PS: heading = direction/turning?

Re: steering wheel to left and right with bos/cob file

Posted: 14 Apr 2019, 21:31
by Forboding Angel
Yes, heading is one of the arguments in your wheelcontrol() function, so you should be able to use turn wheel to heading.

Just make sure that earlier in the function you have limited the angles.