Question unable to focus ("f" key)

vamplayer

Member
Messages
35
Reactions
4
Points
8
I have never been able to figure out this one problem in VaM.

When VaM is normal, if I click on a control on a body (head, chest, hand, ...) and click on "f" to focus, then I'm able to rotate around that body part by dragging the right mouse button.

But sometimes for some reason, clicking "f" to focus after clicking a body part makes the atom hop around the screen on every click to focus. (No it's not the same problem as when things are jumping around so fast by themselves as in an explosion.)

So when this "focus" problem happens, there's nothing I can do to get it back to normal except for doing a hard reset or restart. I tried setting things to default. Tried starting a new scene. Nothing worked.

So my questions are:
Is there a setting in VaM to recover from this? And if not, can we do it with scripting?
 
Never heard of that problem. Maybe you use some session plugin (or plugin in the scene) that is acting up?
It happens after we move things around a bit. To reproduce, just use a template and put these simple lines in Update().

Vector3 dest = SuperController.singleton.GetSelectedController().transform.position;
Transform transform SuperController.singleton.centerCameraTarget.transform;
transform.position = Vector3.Lerp(transform.position, dest, 0.5f);

Add this plugin to a person. Now when we click on a body part and click "f" to focus, it doesn't focus correctly anymore but jumps around each time. We can try to remove all scene/session plugins (it doesn't matter), it's still the same. Loading a new scene or starting a new one won't do it either. The problem persists until a restart or hard reset.

Related questions (script):
Is there a way to reset when this problem occurs, in scripts? I've tried all of the reset-to-default functions but nothing worked.

How do we properly zoom in/out of a selected controller?
 
Upvote 0
Well, your problem is that plugin, not VaM. There are several things wrong with that "plugin":
  • VaM needs to be able to deal with varrying frame rates. Above code would give you very different results with depending on whether it runs with 30 or 100fps. Esspecially with VaM you have often huge variations in frame rate, depending on whether a physics update needs to be done that frame. e.g. if you run at 100+ fps, but run physics at 60Hz, not every frame needs a physics update. Those frames will be way faster. Therefore movement should be based on Time.deltaTime, which is the time in seconds since the last frame. For example: Vector3.Lerp(transform.position, dest, Time.deltaTime*0.5f);
  • You can't move the camera like that, only read its position. Its more complicated as other things need to be moved as well. Would have to check, but I think there was something called navigationRig. AcidBubbles has a plugin called SpawnPoint you can check for what needs to be done. I'm using similar code for my Benchmark plugin as well to move the camera, but that's also locking the camera which may be confusing, so check SpawnPoint instead ;)
  • "transform" is a member variable of MonoBehaviour. I wouldn't recommend naming a local variable "transform", although I think it does what you expect in this case.
 
Upvote 0
Thanks for your help. Those 3 lines were there to say what if things were messed up. How would VaM recover from that? Shouldn't there be a function to set everything back after that without having to hard reset?
 
Upvote 0
Ain't hard reset a universal solution to a lot of things, lol. Anyway, thanks for the answer and suggestions.
 
Upvote 0
Back
Top Bottom