- Home /
Rigidbody 2D jerk on vertical moving platform
Hi, I have a player with Rigidbody 2D and a platform which is moving verticaly, but don't have Rigidbody 2D on it. When player is on platform it jerks .
Already tried interpolate.
Script :
using System.Collections;
using UnityEngine;
public class Movement : MonoBehaviour {
public float speed=0.2f;
public bool destroy = false;
void Update () {
transform.Translate(new Vector3(0, Time.deltaTime * speed, 0));
if (destroy && transform.position.y < -12)
gameObject.SetActive(false);
}
}
any help or suggetion ??
anything in your scene that will be moving should have a ridgidbody on it even if it is $$anonymous$$inematic, objects without ridgidbodies are considered static and whenever 1 static object is moved in a scene then all static objects get recalculated and this can be taxing on performance.
I know this doesnt answer your question but I felt it important to point out
I tried that to....problem is player jerks not platform
Answer by kornstar83 · Jun 08, 2017 at 11:15 AM
all of your physics code should be run in a FixedUpdate rather than and Update.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html
Your answer
![](https://koobas.hobune.stream/wayback/20220612123742im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Get Rigidbody2D component in script (c#) 1 Answer
Scripted Boundaries Not Working Correctly 0 Answers
Orbital cannon jitters while following/facing mouse position 1 Answer