How do I get the correct mouse position on a 3d Layer

0 favourites
  • 3 posts
From the Asset Store
A game with 3D terrain, realistic water and various 3D objects.
  • I wanned to try out the new 3DCam to give a bit of perspective for my top down shooter, which really looks cool. so i did this:

    https://i.gyazo.com/925a5511de23374458ccd86d6147346f.png

    Now i want the mouse position to be absolute, so where the mouse is the playersprite should be.

    So normally when i scale a layer i just use Mouse.X("layerName") or Absolute to position an object correctly to the mouse.

    However this does not work for obvious reasons with that cammera positon. How do calculate the correct position of the playersprite in a 3DCam perspective? So the playersprite is actually where the player sees the mouse and not on a relative position for to the mouse cursor.

    Hope this is understandable :D

    Does this has something to do with CanvasToLayerX(layer, x, y, layerZ)

    Kind regards

    Joschi

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe this makes it a little more clearer what i mean. the cam is positioned at

    layoutwidth / 2, Layoutheight/2-1000 and looks at LayoutWidth/2, LayoutHeight/2 with a Z of 100.

    1) shows the mouse position

    2) shows the playersprite position

    3) shows the perspective

    Kind regards

    Joschi

  • I still was not able to figure this out :(

    There should be a way to calculate the relative position of the ship based on the 3D camera angle? If not i just have to drop the 3d part for now :(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)