I'm creating a scene in A-frame, but the camera wasd movement is too fast, is there a way to slow down the movement? An older version (0.4.0) specified an acceleration property, but now it's gone.
I've tried the old code, but didn't worked.
<a-entity camera look-controls wasd-controls position="0 1.6 0" acceleration="5"></a-entity>
This doesn't work for the acceleration.
I'm using the version 0.9.0, and the acceleration code is for the 0.4.0.
Acceleration must be a property of wasd-controls.
<a-entity camera look-controls wasd-controls="acceleration: 5" position="0 1.6 0"></a-entity>
Related
I am learning A-Frame and have come up with an issue I am trying solve. The issue is animating a radius for a sphere to create a pulsating effect ie the sphere grows and shrinks. I have created an AFRAME Component and in the animation path i have put in the code is
animation = "property: geometry.primitive.sphere.radius; from: 0.1; to: 0.9"
But I get an error in the console
Error: Unknown geometry schema 0.1
so I think the "0.1" is relating to the radius value.
I also tried another way by creating a THREE.SphereBufferGeometry but i cannot figure out the components path to put into the animation property.
Can anyone advise me the best way to animate the radius of a sphere i would greatly appreciate it.
Thanks
Darren
What do you mean by "I have created an AFRAME Component" ?
To know which property to animate, you can check here on the documentation to what each property is linked. For "radius" is associated with "geometry.radius".
I made a glitch that shows what you want to achieve, is it what you are looking for?
I want to create a webvr scene that allows a user to click on objects as events and move around the scene. Is this possible using a-frame? I know that a frame allows you to do both of these with a mouse and wasd keys on a computer. How does this work on mobile phone? Can the user still walk around a scene?
Yes, it is possible to click objects while in mobile/VR and move around, but it is somewhat complex. Lets break it down.
1) Clicking without using buttons is called fusing. It involves the user hovering over an object for a certain period of time, and then a fuse event is thrown, which can be caught by a listener just like a click event.
You can set the fuse properties inside the cursor component, and generally it is a good idea to include a small ring locked to the center of the camera view (as a child of the camera) so the user knows that an implicit click occurs inside the ring. You can set that up like this:
<a-entity camera look-controls>
<a-entity cursor="fuse: true; fuseTimeout: 500"
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03"
material="color: black; shader: flat">
</a-entity>
</a-entity>
more on the cursor here:
https://aframe.io/docs/0.9.0/components/cursor.html#sidebar
You also might want to implement a rollover state, to alert the user that an object is clickable, say by changing color on mouse over. Here is a glitch that show how to set up and handle a rollover event:
https://glitch.com/~rollover-rotate
Walking around on a mobile device is no problem using wasd-controls. Clicking on the screen allows navigation. However, if you are using the phone as a VR device, wasd will not work. And even if it did, (some headsets have mouse buttons), the viewer would probably get sick if the camera moves but their body does not. The usual trick is to implement a teleportation system, like the Vive uses, but that is somewhat complex.
Here is a glitch that shows how to build a teleportation system.
https://glitch.com/~aframe-teleport-controls-extra
good luck!
I set camera fov to be 120:
<a-camera fov="120"></a-camera>
It works well in regular mode (shows 120 fov correctly) but when I enter vr-mode in a mobile device it returns to 80. Is it a bug?
see reproduction here
I also opened an issue in aframe github issue page
It's not a bug. It's expected behavior. FOV and other camera parameters are supplied by the WebVR / WebXR API when in VR mode. They're specific to the headset characteristics (IPD, lenses properties...) and cannot be overridden. Stereo rendering would not look right with different parameters.
I'm using A-Frame and I'd like to know if there's a component or a way to smoothly rotate from current direction towards another over a few secs. I plan to use this with the alongpath component just before playing the movement on my camera. Thanks!
I am creating flat tour using a-frame js . I wanted to move camera automatically.currently I am doing that using mouse .can anyone help me?
To do tweening in A-Frame, you'll probably use the a-animation system:
<a-entity camera position="0 1.6 0">
<a-animation attribute="position"
dur="2000"
easing="linear"
to="0 1.6 -10"></a-animation>
</a-entity>
JSFiddle. To customize this, see the animation documentation.
Aside: For VR scenes, moving the camera automatically is often uncomfortable for users, and should be done rarely and without acceleration, if at all.
This along-path component is also good for interpolating an entity's position along a path: https://jsbin.com/dasefeh/edit?html,output