steering wheel to left and right with bos/cob file

steering wheel to left and right with bos/cob file

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
Flaka
Posts: 66
Joined: 23 Jan 2018, 18:34

steering wheel to left and right with bos/cob file

Post 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?
Attachments
armfav_script.JPG
(64.93 KiB) Not downloaded yet
armfav_animation1.JPG
(73.31 KiB) Not downloaded yet
Flaka
Posts: 66
Joined: 23 Jan 2018, 18:34

steering wheel to left and right with bos/cob file

Post 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?
Flaka
Posts: 66
Joined: 23 Jan 2018, 18:34

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

Post by Flaka »

armfav_script.JPG
(64.93 KiB) Not downloaded yet
armfav_animation1.JPG
(73.31 KiB) Not downloaded yet
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

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

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
User avatar
MasterBel
Posts: 271
Joined: 18 Mar 2018, 07:48

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

Post 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?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
Flaka
Posts: 66
Joined: 23 Jan 2018, 18:34

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

Post 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?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

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

Post 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.
Post Reply

Return to “Lua Scripts”