A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: [MX]Collision detection in 3d perspective

Threaded View

  1. #10
    Senior Member
    Join Date
    Sep 2004
    Posts
    633
    If you only use three to four frames, then you only have 4 angles at which the bat can make contact with the ball. Even giving additional pitch types such as curve, slider, or fastball, hat's a pretty limited simulation.
    No, more frames you use ( beyond those 3-4 ) , more limited of a simulation it becomes. Have you made one baseball game yet?

    Assuming we are trying to hit a home run, even 4 frames is one too many if you are running your game at 30-40 fps.
    Swing of the bat has to happen instantly after a player clicks to swing, and if you have too many frames it will feel like you have no control, as the animation plays out too slowly. It'll be like a 3 year old swinging.

    You can add more variety by moving the position of the player relative to mouse position. The most important thing is that player playing the game feels like he's in control and that it feels like a swing, not satisfying programmer's simulation requirements at the expense of gameplay. You can still have an infinite number of reactions depending on what you use to callculate ball flight ( you could use mouse position at the moment of contact, mouse under the ball it flies higher, mouse over the ball it goes down, left right positioning, whatever you want, and the ball can go anywhere, just like in real life ).

    A couple of dot products is not complicated, and is in fact less complicated than using timeline animation principles.
    I didn't say it was complicated, I just said it wasn't necessary and won't give you anything more accurate calculations wise, so why bother. You have to take into account timeline animation if your player is an animation ( if it isn't then who wants to play that anyway )
    The original poster asked how to hitTest in 3D. Obviously the most basic thing there is scale because you judge how far something is by its size as you view it from your perspective.
    Knowing that, he can have it done in a few minutes even if he doesn't know much about scripting. Using some of the above samples he may spend a few days going nowhere ( if indeed he is a beginner ). Then he can add the rest later as needed.

    If he already knows more, and wants to jump right into full 3d, he can do that too, I guess.

    Vector, Schmector
    Last edited by MikeMD; 06-15-2008 at 12:52 AM.

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