Jump to content

Babylonjs action manager


droggam
 Share

Recommended Posts

Hello coders,

I tried scene.actionmanager(

etx and

if(evt.sourceEvent.key=='f')

{ Let sphere666= etx

sphere666.position.y= evt.pointerY

}

so basically what I want is press f

and create sphere at where mouse is at

the code is THE parts i remember rn.

problem is its not Creating a sphere

but pointerX is correct values etx

anyone can help?

Link to comment
Share on other sites

@trevordev

Hi i Will Keep trying.

I tried gui lib No luck

Babylonjs GUI i mean what wrong with it?

Trevor I really tried solve My puzzle

So far this is what i found out I see that pointerX is 666 value and it need divide

It 100 Times to even see THE new created ball in THE screen when

So how do i translate pointerX to real value in babylonjs vector3?

 

Link to comment
Share on other sites

Hi again @droggam I know it is frustrating for you but we do need a working or nearly working playground to build from.  The playground from trevordev http://playground.babylonjs.com/#571YN6 does work even if it is not exactly what you want. In this playground click anywhere on the grey square and the sphere will jump to that position. Instead of making the sphere jump could you make a sphere appear at the place where you click. When you have done this then explain a small change that you want to make to get it closer to your final goal.

Link to comment
Share on other sites

@droggam You could try to use offsetX instead of pointerX, offsetX will be the pixel offset of the canvas you clicked on. You can then use scene.getEngine().getRenderingCanvas().width to get the width of the canvas. Subtract scene.getEngine().getRenderingCanvas().width/2 from the offset X and you have the distance in pixels from the center of the canvas. Multiply this by a ratio to convert pixel distance to meters (eg. 1/100) and set the x position to that. Maybe that is more what you are looking for?

Link to comment
Share on other sites

Ye i Will try i started out with phaser3

And happy i changed to babylonjs.

Feel like more fun n documentation

I just feel gamedev in general is buggy and errorprone 

What is offset exactly i Will research for sure but IF pointerX is not correct how to builds working game.

And another question what is a Good approach of i want say a grid and put items in THE small boxes like i Said tried install babylonjs GUI but it couldnt find THE packade in npm terminal

@trevordev

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...