Forum Discussion
ttgjou
6 years agoHonored Guest
Jitter moving a simple object using Unity in VR
I have a problem that I don't know because there are so few people who suffer it too.
I am making a game where I need to move an object over the scene from one point to another using code.
****************************************************************************************
I have tried to:
All with the same result . It doesn't happen to you?
I would appreciate a help because I can't think of what else to do.
Thank you very much!!
I am making a game where I need to move an object over the scene from one point to another using code.
The problem is that when I see the object move using the VR glasses, I see the movement as with jitter and the faster it moves, that jitter gets worse.
Note:
I use Unity 2019.1.14
The code is very simple:
public class DesplazamientoPruebas : MonoBehaviour
{
public Transform[] puntos;
public int contador = 0;
Vector3 posicion;
// Start is called before the first frame update
void Start()
{
Application.targetFrameRate = 90;
posicion = puntos[contador].position;
}
// Update is called once per frame
void Update()
{
if( Vector3.Distance(transform.position,puntos[contador].position)<2 )
{
contador++;
if (contador > 1)
{
contador = 0;
}
posicion = puntos[contador].position;
}
transform.position = Vector3.MoveTowards(transform.position, posicion, 0.2f);
}
}
{
public Transform[] puntos;
public int contador = 0;
Vector3 posicion;
// Start is called before the first frame update
void Start()
{
Application.targetFrameRate = 90;
posicion = puntos[contador].position;
}
// Update is called once per frame
void Update()
{
if( Vector3.Distance(transform.position,puntos[contador].position)<2 )
{
contador++;
if (contador > 1)
{
contador = 0;
}
posicion = puntos[contador].position;
}
transform.position = Vector3.MoveTowards(transform.position, posicion, 0.2f);
}
}
**************************************************
This script is assigned to the object and I only observe how it moves when I start the game.I have tried to:
- Modify the time in the game preferences to leave it as 1/90 or 1/60.
- Change all playerSetting parameters following the Oculus recommendations.
- To move the object I tried Update () with time.deltatime
- FixedUpdate with Time.fixedDeltaTime
- LateUpdate with time.deltatime
- I have tried as functions:
- Transform.Translate
- Vector3.Lerp
- Verctor2.MoveTowards
All with the same result . It doesn't happen to you?
I would appreciate a help because I can't think of what else to do.
Thank you very much!!
1 Reply
Replies have been turned off for this discussion
- FocusVRGamesAdventurerHi
From the look on your code, your distance travelled on each update is too high.
I would look to use iTween instead as this will give you some finer control and result in smooth animations
Its free in the asset store
https://assetstore.unity.com/packages/tools/animation/itween-84
This is the website
http://pixelplacement.com/itween/index.php
Good luck
Mike
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago