Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3450894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:05:36+00:00 2026-05-18T09:05:36+00:00

Alright, so I got two angles. One is the joystick’s angle, and the other

  • 0

Alright, so I got two angles. One is the joystick’s angle, and the other is the camera to player angle. The camera’s angle. Now I want it so when I press up on the joystick it moves the player away from the camera. How would I do this? And is there a easy way to do it in Java or Ardor3d?

edit: Here is the code of how I get my angles.

float camDegree = (float) Math.toDegrees(Math.atan2(
                     _canvas.getCanvasRenderer().getCamera().getLocation().getXf() - colladaNode.getTranslation().getXf(),
                     _canvas.getCanvasRenderer().getCamera().getLocation().getYf()) - colladaNode.getTranslation().getYf());

            player.angle = (float) Math.toDegrees(Math.atan2(padX, padY));
            Quaternion camQ = new Quaternion().fromAngleAxis(camDegree, Vector3.UNIT_Y);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:05:37+00:00Added an answer on May 18, 2026 at 9:05 am

    I have to say that I don’t really understand your question, but it seems to be about how to implement camera-relative control using a joystick.

    The most important piece of advice I can give you is that it’s better not to compute angles, but to work directly with vectors.

    Suppose that the camera is looking in the direction v (in some types of game this vector will be pointing directly at the player, but not all types of game, and not always):

    the look vector from a camera to a player can be resolved into vertical and horizontal components

    Typically you don’t care about the vertical component of this vector, so remove it to get the horizontal component, which I’ll call y for reasons that will become apparent later:

    y = v − (v · up) up

    where up is a unit vector pointing vertically upwards.

    We can find the horizontal vector that’s perpendicular to y using the cross product (and remembering the right hand rule):

    x = v × up

    the vectors x and y form a horizontal coordinate basis

    Now you can see that y is a vector in the plane pointing forwards (away from the camera), and x a vector in the plane pointing right (sideway with respect to the camera). If you normalise these vectors:

    x̂ = x / |x|

    ŷ = y / |y|

    then you can use x̂ and ŷ as the coordinate basis for camera-relative motion of the player. If your joystick readings are Jx and Jy, then move the player by

    s (Jx x̂ + Jy ŷ)

    where s is an appropriate scalar value proportional to the player’s speed.

    (Notice that no angles were computed at any point in this answer!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright.. I'm struggling with this one.. I've got an image with a transparent hole
Alright this probably sounds easier than it is :) I've got two files: file1.php
Got the guestbook working alright. New messages are building up nicely. Now, only the
Alright, so I've got a couple divs wrapped in a container. The two interior
Alright, this one (3a; sample problem with provided answer) has got me scratching my
Alright, I finally got this code to work after hours of toiling: Dim path
Alright, I hope this isn't too broad a question but my curiosity got the
Alright, this one's interesting. I have a solution, but I don't like it. The
Alright so I've got this script sort of working. The ajax call works and
Alright, so I got my form to email most of the variables in php.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.