How do I use mouse control 3d camera facing?

1 favourites
  • 9 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • The new 3d camera is very interesting.

    I added an event to make the Player always face the mouse position

    Player: Set angle toward positionSelf.X + cos(angle(Self.X, Self.Y, Mouse.X, Mouse.Y)) * 150 Self.Y + sin(angle(Self.X, Self.Y, Mouse.X, Mouse.Y)) * 150

    Clipboard:(need Mouse Plugin)

    {"is-c3-clipboard-data":true,"type":"actions","items":[{"id":"set-angle-toward-position","objectClass":"Player","parameters":{"x":"Self.X + cos(angle(Self.X, Self.Y, Mouse.X, Mouse.Y)) * 150","y":"Self.Y + sin(angle(Self.X, Self.Y, Mouse.X, Mouse.Y)) * 150"}}]}
    

    Preview the game, The camera turns very fast and it always shaking. it seems to be difficult to control. I think it is too sensitive and there should be an updated threshold. I don't know how to set it.

    Tagged:

  • It is still using a 2D plane for mouse position so like in the example project you have to imagine the camera/player in a 2d top down sense.

    You could use something like:

    If mouse is moving* (Need to set up events to detect mouse movement)

    Sub Events

    if mouse.X < (viewportright-viewportwidth/2) set player angle to self.angle-1

    if mouse.X > (viewportright-viewportwidth/2) set player angle to self.angle+1

    EDIT: Better to do a distance from centre rather than is moving

  • This works nicely.

  • You guys rock, I was looking for this help exactly. Thank you!

  • will you post the c3p? still spinning like crazy for me -_-, Thank you again for your help so far. :)

  • Make sure you create a 2d layer and use that for the mouse reference. You can see in the events that it says Mouse.X("UI") which references a 2D layer called UI

  • me too please need an example c3p

  • Make sure you create a 2d layer and use that for the mouse reference. You can see in the events that it says Mouse.X("UI") which references a 2D layer called UI

    I'm having trouble trying to copy your code, can you please post the c3p?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This works nicely.

    I need a camera like in the first person controller, can you help me implement this?

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