Results 1 to 3 of 3
  1. #1
    Blagojee is offline Member
    Join Date
    Apr 2017
    Rep Power

    Default Spawning object on mouse coords

    I have a problem with my program, it has lagging in positioning an object on mouse x and y
    here is a example of itSpawning object on mouse coords-capture.png
    Here is Algorithm that I used:
    Java Code:
        x.px = normalize((mouse.x - + camera.viewportWidth/2) * c.AU); = normalize((mouse.y + - camera.viewportHeight/2) * c.AU);
    here is full code:

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Spawning object on mouse coords

    Can you make a small, complete program that compiles, executes and shows the problem?
    Post it here wrapped in code tags.

    A suggestion: Your debug display should show the values of x and y in addition to the names.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: Spawning object on mouse coords

    Ugh! The use of tends to make me think this isn't from the Java API.

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Object follow mouse
    By Joey0412 in forum New To Java
    Replies: 19
    Last Post: 04-22-2012, 05:39 PM
  2. Help with mouse moving object and colisions
    By macwadu in forum AWT / Swing
    Replies: 12
    Last Post: 07-02-2010, 12:18 AM
  3. Mouse Listener for mouse floating over object?
    By Krooger in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2009, 05:34 AM
  4. placing JButtons with x and y coords (possible?)
    By v1nsai in forum New To Java
    Replies: 4
    Last Post: 08-18-2009, 07:21 AM
  5. change object color on mouse click
    By gotenks05 in forum Java Applets
    Replies: 1
    Last Post: 04-05-2009, 08:14 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts