Predictive Projectile Path

General discussion about Box2D tutorials
Post Reply
anupsv
Posts: 3
Joined: Tue Nov 19, 2013 5:40 am

Predictive Projectile Path

Post by anupsv »

Hi Team..

I just joined the forum. I am facing a problem in displaying a predictive projectile path (just like angry birds). I am using Cocos2d and Box2d physics engine and developing using javascript for Firefox OS.

Please anyone suggest.

Thank you.
welivehere
Posts: 6
Joined: Thu May 23, 2013 12:24 am

Re: Predictive Projectile Path

Post by welivehere »

anupsv
Posts: 3
Joined: Tue Nov 19, 2013 5:40 am

Re: Predictive Projectile Path

Post by anupsv »

I had checked that link already, but the problem there is it is done using flash js. I want the same thing in normal js using Box2d. Please suggest if any links available.

Thanks a lot.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Predictive Projectile Path

Post by iforce2d »

If you know the starting position and velocity, you can calculate the position of a body in the future using the getTrajectoryPoint function as shown in this tutorial: http://www.iforce2d.net/b2dtut/projected-trajectory

The function will be almost exactly the same in Javascript. If you can show us your Javascript version, maybe somebody can spot the problem. Please don't post hundreds of lines of code that you copied from the Angry Birds HTML5 game, nobody wants to read that.

I guess you are the guy from the Disqus forum, and the guy who has been posting this same question in many other forums in the last couple of days. I'd like to help, but it seems like you have not put in any effort to solve this problem yourself, and sometimes it seems like you don't even read my posts properly when I reply. Perhaps you are just hoping somebody will give you some code so you don't have to write anything yourself, but it ain't gonna be me. If you don't show some reasonable attempt at this yourself (I'm talking Javascript source code that you wrote yourself, not just telling us you googled) in your next post, I will ignore it.
Post Reply