Need Someone To Teach Me How to Rotate an Object via Toggle or Button

Twelvepak

Active member
Messages
37
Reactions
10
Points
33
Patreon
Twelvepak
I tried experimenting with the toggles and buttons to try and make an object rotate from one position to another position, but I can't get anything to happen. Can someone teach me how to do this, or if there is a tutorial explaining this, can you point me to it? Just as an example of what I am trying to do, picture a cube or a tube that is face one direction, and upon a toggle box check, or button press, I want said object so spin 180 degrees, and stop in that position. Then upon un-checking the toggle box, or pressing the button again, I want it to rotate back to its original facing direction. This seems simple, I just don't know the right parameters in the triggers to set up.

Thanks in advance.
 
Hey there!

Hopefully I got you right. No native speaker here but I give my best. So there are several options to archive your target. But let´s keep it simple and use the inbuilt animation pattern system. Basically you set up an animation pattern and create two points. Set up your object you want to be rotated to it´s starting point. Now move the animation pattern step 1 (move select from scene is the easiest way) to you object you want to control. Do the exact same thing with the animation pattern step 2. Now select the control node of your animation pattern step 2 and in the "move" tap rotate it 180 dagrees (basically to your end point).
Now you can set the animation pattern to control the object you want to rotate within it´s animation pattern tab. You should see your object now rotating the whole time. From here you can manage your options and trigger the animation pattern in any way you can think of. For you example now you could:
- > Decativate the loop function of the animation pattern
- > Create a button and in the trigger tab create a event wich plays the animation pattern (the event includes it´s active by pressing)
In this case you weould need an other button to reset your animation pattern but this could be done by animation timeline also.

Like said, this is pretty simple and easy to use. Hope this helps you out a bit (Gato)
 
Thanks for the reply Gato, big fan of yous btw. I have actually gotten pretty decent with animation patterns, I use them quite a bit. For the particular application I am going for though, I am trying to avoid using an animation pattern. I think what I am looking for is a way to toggle the postion state between 2 predetermined locations for a particular atom. It looks like the trigger tools have this functionality built in, but as of yet I haven't been able to make them do anything through trial and error. I already have a plan in mind for using an animation pattern to make it work if I have to, but I was hoping there was another way.
 
Thanks for the reply Gato, big fan of yous btw. I have actually gotten pretty decent with animation patterns, I use them quite a bit. For the particular application I am going for though, I am trying to avoid using an animation pattern. I think what I am looking for is a way to toggle the postion state between 2 predetermined locations for a particular atom. It looks like the trigger tools have this functionality built in, but as of yet I haven't been able to make them do anything through trial and error. I already have a plan in mind for using an animation pattern to make it work if I have to, but I was hoping there was another way.

Thank you, we do our best in our little studio ;) Yes, somtimes the "ways of VaM" are mysterious at all. Things seem obvious in the first instance just to kick you off in the second. You find a way through fore sure! Excited about the result.


As a simpler alternative, having a look at the LinearAnimation brick from LogicBricks may be worth a try. Essentially you set two positions and set the value parameter to anything between 0 and 1 to blend between both positions.

Getting used with LogicBricks is way too long on my personal "To Do" list because I am a bit tired of VaMs "natural" limitations in some cases I have to friggel around and find workarounds. Love your work! Very professional. Actually that much professional I assume you´re working mainly in the gaming/IT industry anyway :sneaky:
 
Hi did you ever figure this out? I'm trying to do something similar. Basically I want to make a knob / turn dial that I turn by hand, like with my VR controllers turn the knob like I would in real life.

I have a button in the middle of the dial that I want to return the dial to 0 on the Z-Rotation so it's pointing straight up again in its default position.

I don't want it to be an animation because the dial could be in any position in its 360 degree arc and I have no way to make an animation do that from any position (at least to my knowledge). Unless perhaps if I'm using animation the animation pattern steps and have it be linked to the dial, so the initial step would always be the same rotation as the dial, and the second step would always be 0. Would that work????

Anyone knows how to do this??

Edit: So I did have the solution to my own problem here. I was able to make a 2-step animation pattern. The first step in the pattern is physics-linked to the dial for rotation only (I also limited its axis in the Move tab). I then tested this quickly to see if the pattern step atom was in fact rotating with the rotation of the dial. It was, ok cool.

Step 2 was set in the rotation I want the dial's default position to be.

Then I linked the master animation pattern to the sphere as its target

Then set the button's trigger to start the animation, with an animation trigger set at the end of the animation to reset the animation (this second part was key as I found myself unable to freely rotate the dial anymore with the animation in its finished state but not reset)

Now I can rotate the dial freely anywhere I want and when I press the button it will swing the dial back around to zero in however many seconds I set the animation to be. Great!

And just as an aside, I have the dial, which is just a flattened out sphere restricted in all rotational axis except for Z so that when I grab it, all I can do is rotate it in its Z-axis.

I haven't found any way to specifically set the rotational values of an atom through any built-in triggers in vam.

On an aside aside there are so many things that they just don't let you do in this sim. THE BIGGEST one being unable to change the target atom of a trigger. Like say I am changing some morphs on a person through some in-world sliders that are linked to the morphs of that actor. I have found no way, through triggers, to change the sliders' target atom to another actor. Like say I had a button that says actor 1 and another that says actor 2. If I press actor 1 it will make the sliders affect actor 1 and press actor 2 it will make the sliders affect actor 3. The only way I can think to do this is to have 2 sets of sliders in the exact same place and when you press actor 1, it hides the ones for actor 2, and press actor 2 it hides the ones for actor 1. But that's a SHITLOAD of atoms in the atom list menu. Very very frustrating. Any way to do this, too? As well as my original question??
 
Last edited:
Like say I am changing some morphs on a person through some in-world sliders that are linked to the morphs of that actor. I have found no way, through triggers, to change the sliders' target atom to another actor. Like say I had a button that says actor 1 and another that says actor 2. If I press actor 1 it will make the sliders affect actor 1 and press actor 2 it will make the sliders affect actor 3. The only way I can think to do this is to have 2 sets of sliders in the exact same place and when you press actor 1, it hides the ones for actor 2, and press actor 2 it hides the ones for actor 1. But that's a SHITLOAD of atoms in the atom list menu. Very very frustrating. Any way to do this, too?
That is the correct way I'm afraid.

There are some ways to make it easier and tidier, though:
  • Define all the UISlider atoms as hidden. So when you toggle the "hidden atom" display (shortcut: "h"), you'll see a way shorter list of atoms.
  • Parent all your UISliders atoms to 1 atom for each actor (could be an Empty atom, could be your "Actor" button, whatever). Then you just have to toggle the visibility of this atom (trigger "AtomControl > "ToggleOn" or "On") and all your UISliders will appear/disappear at once.
  • You can avoid doing the work twice by using subscenes. Do the work for only 1 actor (create your actor and all the UISliders related to it). Parent all those atoms to a subscene and save it. Then add a new subscene and load the subscene file you've just saved. Tadaa, you've got your 2nd actor with all your atoms already set!
 
That is the correct way I'm afraid.

There are some ways to make it easier and tidier, though:
  • Define all the UISlider atoms as hidden. So when you toggle the "hidden atom" display (shortcut: "h"), you'll see a way shorter list of atoms.
  • Parent all your UISliders atoms to 1 atom for each actor (could be an Empty atom, could be your "Actor" button, whatever). Then you just have to toggle the visibility of this atom (trigger "AtomControl > "ToggleOn" or "On") and all your UISliders will appear/disappear at once.
  • You can avoid doing the work twice by using subscenes. Do the work for only 1 actor (create your actor and all the UISliders related to it). Parent all those atoms to a subscene and save it. Then add a new subscene and load the subscene file you've just saved. Tadaa, you've got your 2nd actor with all your atoms already set!
Yes I have thought of the whole subscene thing as well but haven't experimented with the hiding things.

I feel like I'm getting myself into something far more than I can chew with my project lol.

Something else I could do, I guess, is to be able to set up my interface to be able to save a preset for the actor, as well as load in the default appearance preset. In essence, I want to build a nice interface that is essentially a "character creator" without needing to dive into all the horrendous VaM menus to change the physical look of your actor.
 
Back
Top Bottom