Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jun 13, 2015 5:31 pm 
Offline

Joined: Fri Apr 17, 2015 5:50 am
Posts: 8
Location: Moenchengladbach, Germany
Hello everyone,

as already indicated in another thread, I published my physics engine on GitHub now. It is licensed under the zlib license. It is implemented in Object Pascal.

GitHub repo: https://github.com/BeRo1985/kraft.

Compatible with: Delphi 7-XE7 (but not with the Android and iOS targets), FreePascal >= 2.6.2 (with almost all FPC-supported targets including Android and iOS)

The Kraft Physics Engine has the following features:

  • Rigid body dynamics
  • Discrete collision detection
  • Optional additional continuous collision detection, either with Bilateral Advancement or Conservative Advancement
  • Full one-shot contact manifold collision shapes (spheres, capsules, convex hulls, boxes, and for static geometries also triangle meshs)
  • Multiple collision shapes per rigid body without the need for a compound shape
  • Broadphase collision detection with a dynamic AABB tree
  • Fast mid phase for static triangle mesh geometries
  • Narrowphase collision detection
  • Collision response and friction (Sequential impulses with post projection)
  • Joint constraints (Grab, Distance, Rope, Ball Socket, Hinge, Slider, Fixed)
  • Collision filtering with groups
  • Ray casting
  • Sleeping of inactive rigid bodies
  • Island-based multithreading
  • SIMD optimizations for x86-32 (later also for x86-64)

Future possibly possible features:

  • Sphere casting / Linear casting
  • Raycast vehicles
  • More joint constraint types (for example cone twist, universal and/or general 6DOF)
  • Cloths / Soft body

Feedbacks and comments are welcome.


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 7:22 am 
Offline

Joined: Tue Oct 24, 2017 7:11 am
Posts: 2
Hello,

Better late than never... I'm stuck so I'll still awake this thread and hope you're still there.

First, I'm only an average skilled programmer, please speak to me like to a beginner.

The demo of kraft "Sandbox" is impressive and works well

I use Delphi and tryed to make Kraft and Firemonkey work together.

The idea was basic and simple.

I had to to sync a fmx Tcube Matrix with a Kraft TRigibody shape matrix.

but I failed partially and don't understand why (searching a solution for 2 or 3 weeks now)

while the cubes do stack well and even bounce a little like expected, they do not rotate

Instead of rotating they slide ! (Guru meditation)

Would you mind helping me out with this ? Could I PM you my source code ?

Thank you in advance
PS: I know your kraft project is still active, so I have great hopes

Cheers
Chris


Top
 Profile  
 
PostPosted: Sun Oct 29, 2017 1:25 pm 
Offline

Joined: Tue Oct 24, 2017 7:11 am
Posts: 2
Hello there, or not there :D

Finally I got it working. It took me one more week with my "try and fail + intuition" technique, but I got the expected result.

My initial intuition about assigning kraft matrix to firemonkey tcube matrix was good. Only I have to mutilply by -1 m12, m22, m32 and m42 or everything is inverted.

My alternate try with the TransformationFromKraft function extracted from Caste Game engine Kraft implementation with vector and angle computations
Q := QuaternionFromMatrix4x4(Shape.InterpolatedWorldTransform);
QuaternionToAxisAngle(Q, Axis, Angle);
Cube.RotationAngle.Vector := Vector3D(Axis.X, Axis.Y*-1, Axis.Z, angle);
was a complete failure with plenty of gimbal lock issues with cubes spinning crazy. I must have missed something because there is no such issue in the engine.

The problem witn matrix assignation is that I had to subclass the Firemonkey TControl3D object to get access to the private read only matrix. And of course, after assigning the matrix rendering is correct but all internal variables position, rotationangle, scale are wrong. They just don't expect anyone having to assign the matrix and don't handle it at all, ... my disappointment.

But this is not a kraft issue, so I just digress for the story.

Another issue is that on my android device (an old lg g2 mini) performance falls fast when adding cubes. I'll have to find ways to optimize. I guess the inverted Y axys in the matrix is not helping.

Well that's all folks, for now.
At least you know someone enjoyed your work
Kraft is amazing
Thank you

Attachment:
Screenshot_2017-10-29-14-35-03.png
Screenshot_2017-10-29-14-35-03.png [ 61.68 KiB | Viewed 404 times ]


PS: Kraft is compatible with Delphi tokyo but I had to mod it a little for android target


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group