Using physics in monkey

Monkey Forums/User Modules/Using physics in monkey

wiliamtn(Posted 2013) [#1]
Hi everybody

Is there any physics's engine for monkey?


rIKmAN(Posted 2013) [#2]
There are a few on the Module Registry...

Box2D
https://code.google.com/p/monkeybox2d/

Chipmunk
https://code.google.com/p/chipmonkey/

Fling (Physaxe)
https://code.google.com/p/fling/


AdamRedwoods(Posted 2013) [#3]
Chipmunk doesn't exist.

I tried out Box2D and Fling, both downloaded from browsing the source (zip option) rather than the downloads part.

Box2D was great, a little slow on Android, but Android release mode was about 14fps (domino stack test). Fling was a bit slower, but I do like the API a little more than Box2D. Both ran very fast on desktop and html5.

Muddy shoes did both remarkably, and he spent more time optimizing Box2D Android than Fling, and the results show.


Sammy(Posted 2013) [#4]
Muddyshoes has done a fantastic job with the Box2D optimisation and the problem I feel now lies with Java rather than his Monkey code.

I've used Box2D via the NDK on Android with GLBasics inline C option + static linking. It was very fast when compared to the iOS test I did. So I know it 'can' run very efficiently on Android.

Has anyone tried compiling Muddyshoes lib using the NDK target on Android? Google recommends using the NDK for compiling physics libs as part of its NDK introduction.

Or some sort of direct linkage to the C lib may be possible now we have an NDK target for Monkey?


wiliamtn(Posted 2013) [#5]
Ok

Added box2d my modules folder of monkey, now I'm looking for some article or tutorial to teach me the basic code of preparation for the physical world and how to add an image to a force.

For example AddForce used in Unity3D

Could someone pass me an article or tutorial if possible a code showing this early?


Nobuyuki(Posted 2013) [#6]
Dig into the code examples a bit, otherwise you'll probably have to use a tutorial made for box2d's flash port. There is also a C++ manual. That's what I used to learn it -- it's kinda a pain if you're not used to the paradigm, but once it starts to click it's not so bad.


wiliamtn(Posted 2013) [#7]
thank you my friend


AdamRedwoods(Posted 2013) [#8]
apply a vector force to a world point
Class b2body:
Method ApplyForce : void (force:b2Vec2, point:b2Vec2)


i also think you can SetAwake(true) a b2body and SetLinearVelocity(b2vec2) to do something similar.


wiliamtn(Posted 2013) [#9]
Hello AdamRedwoods

Thanks man, but you can tell me that there is a way to apply that strength in angular points.

example in a game of billiards


muddy_shoes(Posted 2013) [#10]
http://www.iforce2d.net/b2dtut/forces


Sammy(Posted 2013) [#11]
Whoops, no NDK target available yet, just thought it wasn't available because I've not got the NDK SDK installed.


MikeHart(Posted 2013) [#12]
The iforce tutorials were my goto when i wrote the box2d wrapper for fantomEngine.