Home Technical Talk

Help with animating a spinning object.

hello,

As my first post I would it rather be of this finished but, it would seem that I need a hand in the animation side of this. :susp:

halp.jpg

you see I want to get the barrel of my gun here spinning up/constant/down with the slider.

im currently using a script on the controller for the barrel group for the rotation.


(SLD_Spin being my slider)

dependsOn $SLD_Spin.value.controller

SpinRate = $SLD_Spin.value
degtorad((CurrentTime)*31*SpinRate)

this works for constant speeds but wont allow me to add key-frames of it, if I auto key-frame I get strange results with the spin. plus I would rather be able to control it with a single key rather than having it bunched up with others.

Using Max2010.

Thanks in advance,

~Atheistsoul

Replies

  • Piflik
    Options
    Offline / Send Message
    Piflik polycounter lvl 12
    Firstly, don't use Groups...Groups are evil...

    Have you tried Custom Attributes instead of a slider...you should be able to keyframe them no problem...

    Also you don't need the Depends On part in the new script controllers...

    Workflow:
    Create a helper Object (or use the base of your gun), add an attribute Holder Modifier and use the first script I posted to create the custom attribute (it creates a spinner and slider that both are connected to the same track...not possible with the standard procedure ;))
    Add a Float Script to the one of the Rotation Tracks of the object you want to rotate (example a Helper that is parent to your barrels...don't use Groups...they are evil...)
    Create a new Variable called 'SR' in that Float Script, click on assign Track and select the SpinRate Attribute in the Attribute Holder.
    use the second Script I posted.

    #1
    ca=
    attributes SpinRate
    (
    	parameters SpinRate rollout: SpinRate 
    	(
    		Spin_Rate type:#float ui:(SpinSP, SpinSl)
    	) 
    	
    	rollout SpinRate "Spin"
    	(
    		label SpinL "Length:" align:#left across:2 spinner SpinSP range:[-10,80,0] fieldwidth:80
    		slider SpinSl range:[-10,80,0] --change the values to your liking, bit use the same for both controlls ;)
    	)
    )
    
    custAttributes.add $.modifiers[1] ca --the number of the modifier might differ from 1...
    

    #2:
    degToRad(currentTime*SR*31)
    
  • Atheistsoul
    Options
    Offline / Send Message
    Many Thanks, :)

    im still getting weird issues with it though. made a quick render of the spin up and down.
    as you can see spinning up is ok, once it reaches its top speed in this case 1 as any more made it go crazy. after the peak is reached it seems to slow a little. With some blur this wont matter I think. but at the end the barrel seems to reverse on its self. no idea what's going on here.


    Video Link.
    [ame="http://www.youtube.com/watch?v=cOBgYC4Ns28"]http://www.youtube.com/watch?v=cOBgYC4Ns28[/ame]

    ~Atheistsoul
  • Mark Dygert
    Options
    Offline / Send Message
    I think its running into the wagon wheel effect or stroboscopic effect, depending on who you talk to.
    http://www.ehow.com/about_5108375_stroboscopic-effect.html
    http://en.wikipedia.org/wiki/Stroboscope
    Strobe_2.gif

    There is a certain speed that when certain frames line up things can come to a dead stop or more commonly reverse. Which is why most film and TV shows will cut away as a car passes through that speed, or they'll shoot at a slower speed and speed up the final footage.

    It's just par for the course when you're working with frames... Depending on the frame rate and the speed you can change things up to almost get rid of it. Try rendering at 15fps instead of 24, bla bla bla...
  • Atheistsoul
    Options
    Offline / Send Message
    Its not that I'm sure Vig, its definitely going in reverse in the spin down -__- who would have known a gun barrel spin would be so annoying. I'm off to read though the 3ds bible, wonder if there's a solution within its many pages.

    Unless anyone knows of a better way to make a spin up/down that can be controlled for animation.

    ~Atheistsoul
Sign In or Register to comment.