User Tag List

Results 1 to 3 of 3

Thread: Mimicking Z-Axis - MATH help!

  1. #1
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mimicking Z-Axis - MATH help!

    Alright! Now, let's see if I can describe this...

    I have two objects in an isometric display. One object is taller than the other, and the shorter object is trying to shoot something at the top of the taller object (Headshot!). I'll just call it a bullet.

    Also, the tall object and short object also have invisible objects associated with them, to represent their actual placement on the field and the size of them in an invisible, overhead layer, to make collisions easier, and handle X and Y axises better, etc.

    Now, the bullet that will be shot from the small object to the tall object will travel at a direct line. This bullet is invisible. The invisible bullet has an object that represents its placement on the isometric display, and an array/ Alterable Value is used to determine the elevation of the bullet above the ground. Works fine.

    Now, here's where the math comes in. What I'm trying to do is figure out a formula for how much the bullet has to rise (add X to Alterable Value) so that it'll appear to hit the head of the tall object once the invisible bullet hits the invisible representative of the tall object.

    I tried using the slope formula (y2-y1)/(x2-x1) and multiplied the resultant value by the speed that the bullet was traveling (Alterable Value * (Speed( "Bullet")*8)), and it worked fine except for when there was no difference in the x values, which would give me an undefined slope, as apparently that method only works for objects in 2D space only... Something I should've known.

    I think the solution has to deal with the distance formula and determining that distance to then be multiplied by the speed of the bullet and some kind of 3D slope to make it work. ... But I'm just guessin'.

  2. #2
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mimicking Z-Axis - MATH help!

    Moving the bullet object in the 'visible' layer toward a certain "trajectory or point" could easily be achieved with interpolation or one of two methods of motion, the first is basically what you explained above, except with an inverse slowdown to the 2D movement of the bullet( to simulate the effect of moving on a slope )


    However there is a much better method which allows arbitrary 3D movement; with the downside being that positions must be controllet manually (instead of using any of the pre-made Movements, eg. bouncing ball)


    It works like this;

    Each instance of 'bullet' will have 6 motion related alterable values which we shall call;

    Xposition, Yposition, Zposition

    Xdirection, Ydirection

    And BulletSpeed.

    ( Zdirection is omitted here, since spinning our bullets on there axis of symmetry isn't necessary since there is no air and as such no air-resistance to affect its trajectory )

    'Upright' 3D movement can be reconciled with the following formula

    Xposition=Xposition+((sin(Ydirection)*cos(Zdirecti on))*BulletSpeed)
    Yposition=Yposition+(sin(Zdirection)*BulletSpeed)
    Zposition=Zposition+((cos(Ydirection)*cos(Zdirecti on))*BulletSpeed)


    Finally; Re-projecting the 3-3D position values into 2-2D positions is easy...

    2DXposition=screencentreX+(Xposition/Yposition)
    2DYposition=screencentreY+(Zposition/Yposition)

    In this case, the Ydirection of a bullet is equivalent to MMFs default direction (except in degrees instead of MMFs 0-31 direction scheme)...

    Xdirection is representative of the bullets vertical inclination ( with 0 being forward, 90 being strait Up and 270 being strait down )

    Enjoy

  3. #3
    Clicker Fusion 2.5

    Join Date
    Sep 2006
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mimicking Z-Axis - MATH help!

    Yeah, I was trying to stay away from manual control as much as possible. Tried it with a former project of mine, and things just kept getting messier and messier for me. >< And collisions weren't working for me well.

    Did manage to figure it out though after a bit of poking around the internet for different formulas. Thanks for the help!

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=download&Number=5694&filename=D istanceElevation.mfa

Similar Threads

  1. x and y axis in Android
    By Keli in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 27th December 2013, 10:31 PM
  2. How to sort pictures by Y axis?
    By alspal in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 28th May 2012, 12:47 PM
  3. Strange y axis glitch
    By Spikeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 20th September 2011, 12:28 PM
  4. Y axis question
    By FormerTGFGuy in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 27th December 2006, 09:07 PM
  5. Z Axis Tricks
    By Raphael in forum File Archive
    Replies: 4
    Last Post: 2nd October 2006, 05:38 PM

Posting Permissions

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