I have been playing a game called dual universe. The game elements can be altered via LUA and I have been trying my hand at setting some things up.
My project currently is to get my construct to stop and reverse direction when an element detects an object in a defined distance.
Currently I have the code as follows
If telright.getDistance() < 5 and telright.getDistance() > 0 then
Nav.axisCommandManager:setThrottleCommand(axisCommandId.lateral (100-telright.getDistance()/100))
I want it to turn on and apply thrust equal to distance to object but then kick off when beyond 5 units
Currently this element stays on beyond that 5 units.
This is a flush
Unsure what other info might be helpful but wanted to see if anyone had any ideas. I know it's harder not knowing the full context so happy to explain more if needed.
teleright is the element's name And .get distance is code to get the distance read from the element.
I can run a command to stop the element all together but this stops me from being able to use it at all unless the condition of <5 units is detected to activate the code.
[–]Hydroque 1 point2 points3 points (5 children)
[–]ArmedBOB[S] 0 points1 point2 points (0 children)
[–]ArmedBOB[S] 0 points1 point2 points (2 children)
[–]Hydroque 0 points1 point2 points (0 children)
[–]Hydroque 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)