I don't know if you have to save the component like that in the beginning. You could just use the Get Material and have it as 'This' without piping in your graph variable. Side note, if you don't use the Get Renderer and just work on the material, it'll do it for every one of those object in the scene. Using the Get Render makes the offset only work on that individual's specific material, and instantizes as specific one for that object, which is good :)
@HomeMech3 жыл бұрын
Great point! Yes, eventually we will "paint" the balls individually even though they all share the same material, like you are saying. We are also saving the component on Start because that way it matches the Unity C# documentation entry here: docs.unity3d.com/ScriptReference/Material.SetTextureOffset.html Now that user comments and notes are encouraged on the Unity documentation pages, I'm going to link a few of these videos there :D
@laurengoodwin76522 жыл бұрын
Hi I just tried the anti gravity tube and it worked. But I need my spheres going in the y direction only. How would I do this ?
@HomeMech2 жыл бұрын
Great! So you're thinking something like a vacuum tube, right? Check out the Rigidbody component on the ball--look for "Constraints", there you can freeze the position. On Trigger Enter you get the Rigidbody, then you can use it to constrain the X and Z position. Search for "Rigidbody Set Constraints." You may need two nodes to set the X and then the Z. You might want to do this after a Wait unit (after the Set Velocity) so that the ball can travel a little bit into the collider. And, of course, you'll want to turn those constraints off On Trigger Exit. Another way to do it is to simply divide the X and Z by a number much greater than 3 and then on an On Trigger Stay move the ball, like the conveyor belt. On the conveyor we use Transform Get Forward, but you can create a Vector3 variable and put in your own value or use "Vector3 Get Up."