VR city obj => auto collision? sanity check

I am trying this tn!

OK, very very interesting. I started using it, a couple questions now:

(1.) I could theoretically design an ability that lets me switch between “flow motion” and “teleport motion” right? Let’s say I want to flow around and then jump up a ledge.

(2.) I’m using teleportation mode and collisions, but I don’t seem to be able to jump “on top of” of an object, is there some easy way to achieve that? (or maybe I’m just doing that wrong somehow).

here’s the code I’m working with: Glitch :・゚✧

I’m trying to spawn myself on top of the structure to see if I fall through it, but my spawn code isn’t working either (no idea why):

      //doesn't work;
        // //spawn on top of tower;
        function towerSpawn() {
            xr.baseExperience.camera._position._x = -102.12776084288441;
            xr.baseExperience.camera._position._y = 276.5707864044311;
            xr.baseExperience.camera._position._z = 279.4056826505191;
        }
        xr.baseExperience.sessionManager.onXRSessionInit.add(towerSpawn);

I also tried implementing a ramp (“ramp”), but I can’t teleport on top of it or slide over it. Making it collidable kind of bounces you off it.

So, yeah, love the slidy movement, love the horizontal collision, trying to figure out how to make it so that I can move along the Y axis as well. (get Y-collision, walk on the towers above, etc.).

The collision system used in the movement feature is the same as the one used in a free camera. Try a free camera in your scene, tweak the camera’s ellipsoid, its offset, the scene’s gravity and so on, and it will work just as it works with a free camera.

to change the camera’s position on session init you will need to wait for a single frame to render, otherwise the camera’s position will reset. This can be overridden, but the better way would be:

        function towerSpawn() {       
xr.baseExperience.camera.position.set(-102.12776084288441,276.5707864044311,279.4056826505191;
        }
        xr.baseExperience.sessionManager.onXRFrameObservable.addOnce(towerSpawn);
1 Like

take a look at this now: Login • Instagram

pretty neat, right? thanks for the help with setting the position of the camera

I’m now on the forum trying to get some jump code, so that I can jump around the platforms (I think that when I turn gravity way down, this is going to be insane)


So, here’s my real question though: how do I make it so that I can teleport on top of something? Should I ask this question in another thread? I think that switching between smooth sliding and teleport is actually pretty important for “multi-level environments” (etc.). Can I do this on my own, or is this a babylonjs thing?

Let s discuss it there: Standard jump code (but for VR)

2 Likes