User Tag List

Results 1 to 6 of 6

Thread: Reflecting Angle of a bullet / bounce function using angles

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Feb 2014
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reflecting Angle of a bullet / bounce function using angles

    Hello all, recently I have been tackling a problem that I believe could have a simple fix, I could just be overthinking. Here it is:
    I have a bullet flying at x angle, when it reaches an obstacle it has to reflect, (not the opposite angle apart from at 0,90 and 180 degrees). I have attached a picture for further explanation. Also i am not using inbuilt fusion movement so i cannot use the bounce function. I have come up with a few main inital bullet angles and then next to them put the reflection angle, from the graph there is no correlation.
    Deflecting Bullets.png
    Thanks for the help

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    950
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its just math; collides with a vertical wall - negate the X, collides with horizontal - negate the Y. ie x= x* -1 on a vertical wall; y= y* -1 on a horizontal wall.
    or use this formula −(2(n · v) n − v) explained here; http://www.3dkingdoms.com/weekly/weekly.php?a=2

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Feb 2014
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, how do i calculate the normal of an obstacle?

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    950
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can do it with detectors

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Feb 2014
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry not quite following

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,117
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    >> you can use detectors to test the "angulation" of the obstacle surface
    i.e. two 1 pixel detector you would fastloop against the obstacle,
    until they hit, and then calculate the angle between the two detectors
    this is probably required if you have complex shapes, not just very simple straight surfaces/segments

    if you can manage to use active objects as obstacles,
    you could store some math information describing the surface directly in their values,
    and i.e.

    1) if you can store the obstacle surface segment vector x y components,
    consider the normal vector to V(x,y) in 2D is simply the transpose coordinates with a inverse sign= N(-y, x)

    2) if you don't have the obstacle surface segment vector, you can very simply obtain it from:
    a) coordinates of any segment lying on the object surface: V.x=X2-X1, V.y=Y2-Y1
    b) the object angle (again, assuming it is as simple as a segment, or a rectangle >> a "thick" segment): V.x=cos(angle), V.y=sin(angle)

    3) if you have the object angle, you can also just add 90 degrees to that to directly have the normal vector: N.x=cos(angle+90), N.y=sin(angle+90)

Similar Threads

  1. Replies: 2
    Last Post: 11th April 2017, 06:01 AM
  2. Replies: 4
    Last Post: 2nd July 2012, 09:05 PM
  3. Vector bullet fired from 360...how to set angle to face direction?
    By Blacstar in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 8th March 2012, 06:01 PM
  4. Reflecting everything on top of a surface
    By Yikes in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 4th December 2011, 03:30 PM
  5. Angle bounce?
    By PandaExplosion in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 28th May 2011, 11:49 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
  •