nunuStudio icon indicating copy to clipboard operation
nunuStudio copied to clipboard

How to make a slight strafe movement (left right) when move a mouse?

Open petepolyakov opened this issue 4 years ago • 3 comments

Good evening, I wanted to create a slight interactive parallax when you move mouse left or right (camera position moves on one or two axis with flexible limit). I tried to use Orbital and Control. Unfortunately, they can't (so far as I know) make a slight strafe movement with limits. I was wondering if there is any way around.

details

petepolyakov avatar Oct 05 '20 02:10 petepolyakov

Basically recreating the A and D buttons in FPS games with a limit of "how far camera would slide". I seen in Orbital it's done in regardless of looking left and right, but in my case I wanted to do that strafe camera move.

petepolyakov avatar Oct 05 '20 02:10 petepolyakov

Hello

Yes this should be faily easy place your orbi controls object inside of a Group object.

Then using a script you can move the group object around using the mouse position.

Check the documentations and the examples on the script page https://www.nunustudio.org/page/learn/basics/02_script/page.html.

The scene looks great

Cheers

tentone avatar Oct 05 '20 15:10 tentone

You were right, it was just a couple of lines. Works! Thank you! Will research what commands can be used for a slight drag but already the front page look way better!

btw if someone will need it in the future

var object;
function initialize()
{
	object = scene.getObjectByName("MainCamera

");
}
function update()
{
	object.position.x += Mouse.delta.x * 0.0002;
	object.position.y += Mouse.delta.y * 0.0002;
}

petepolyakov avatar Oct 06 '20 06:10 petepolyakov