Message 1 of 2
Objects "jump" with expressions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there. For my university project, I'm making a space system generator. So far I've managed to get everything working but I decided to create a small spacecraft which will be used to fly around with.
To do this, I created an expression for its X movement as shown below:
I've also hooked this up to a slider which you can set the speed and hit a button to apply that speed setting as shown below (apologies for the crap GUI):
Now my issue is this, whenever I hit play and i set the speed to something and then i change it to another value, the spacecraft "jumps". Heres what I mean:
Is there a way to fix this issue? Heres my code for this:
//NAME: Saif Ahmed Munawar //UB NUMBER: 15010505 //SUBMISSION: Final Project Submission //Solar System Generator\\ //Spaceship Flight Script\\ //This script opens a new window which contains the controls for controlling the spacecraft\\ //I decided to make this seperate since the main GUI would get too clogged up so having a seperate GUI //would be a more appriopiate thing to do\\ global proc throttle() { global float $throttle; $throttle = `floatSliderGrp -q -v spaceship_speed`; $throttle = $throttle*10; print($throttle); } global float $throttle = 0.0; { string $spaceship = `window -t "Spaceship Controller" -wh 500 500`; frameLayout -collapsable true -collapse false -label "Timeline & Misc" -bgc 0.5 0.1 0.1; gridLayout -cellWidthHeight 400 25; floatSliderGrp -label "THROTTLE" -field true -min 0 -max 10 -value 0 -step 1 spaceship_speed; setParent..; gridLayout -cellWidthHeight 584 25; button -label "Set Speed" -command "throttle()"; showWindow $spaceship; }