A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: Adjusting Angles of a Physics Engined object

Hybrid View

  1. #1
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    It's been a while since I played with APE. Something like this:

    Code:
    var projectile:Composite = new Composite();
    var frontBit:RectangleParticle = new RectangleParticle(10,0,5, 5);
    frontBit.mass = 2;
    var backBit:RectangleParticle = new RectangleParticle(0,0,5,5);
    //backBit's mass is 1 by default.
    var connector:SpringConstraint = new SpringConstraint(frontBit, backBit, 1);
    projectile.particles.push(frontBit);
    projectile.particles.push(backBit);
    projectile.constraints.push(connector);
    I probably screwed up something in there, but the gist is that you can now use projectile as your bullet (you can assign it its own sprite too, if you don't want the default boxes), which should rotate in a natural looking manner.

  2. #2
    Member
    Join Date
    Dec 2007
    Posts
    85
    Is there a significance to the increased mass on frontBit?

    In addition, since I need the shell to have a specific starting position and angle, how would I see to translating this into what you gave me? Do I apply them to both bits, just one bit, or to the composite itself?

    Trying to make sure I have a full understanding of how it works and how to modify it properly.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center