The $1000.00 goal is to start development of a worker version, which can offload physics processing to another CPU (with some latency).

Note versions 2.x.x use an experimental rapier physics engine with limited features.

In demo above click mouse to do raycast, create another 3DShape at the raycast hit point and apply a little impulse force. 

To further support development:

Buy Me a Coffee at ko-fi.com

Currently supported only on the 3D Shape.

  • 3D Shape: Box, Wedge, Corner-in, Corner-out, Prism, Pyramid
  • Only z axis rotation (3D Shape only supports z axis rotation)
  • Apply impulse
  • Immovable / movable
  • World gravity setting
  • 3D raycast, skipface, collision filter group / mask
  • Set mass
  • OnCollision trigger
  • CollisionData (from the OnCollision trigger)
  • Set velocity
  • Set linear, angular damping
  • Set collision filter group
  • Set collision filter group mask
  • Apply force
  • Apply torque
  • Support 3DShape full 3D rotation using Rotate 3D Behavior.
  • Add Trigger for raycastResult available (synchronous now anyway, but future may be async)
  • More raycast modes (all, any closest - default)
  • Add expression for x,y,z velocity
  • Heightfield
  • Heightfield for sprite w/o mesh

Open to feedback and development collaboration for future rev share, leave comments or contact me on C3 Community Discord (@mikal1464)

Near term future work
  • 3DObject support (fixed box collider first, others later)
  • Add Trigger for raycastResult available (synchronous now anyway, but future may be async)
  • Apply impulse towards position
  • Detect runtime changes of C3 object size and update physics body.
  • Heightfield
  • Add expression for x,y,z velocity
  • More 3D Shape shapes corner-in, corner-out, pyramid, prism
  • Support 3DShape full 3D rotation using Rotate 3D Behavior.
  • Disable collisions on body (use collision filter group/mask)
  • More raycast options (array of all objects hit, collision filterGroup and mask, skipface), raycast to a particular body (probably identified by UID)
  • Collision filterGroups and masks
  • Apply force
  • Apply torque


Possible future work 
  • Worker mode for physics engine, 
  • Sprite with mesh (e.g. used for a terrain plane)
Usage Notes:
3D Shape
  • Natively 3D Shape only supports Z axis rotation, physics will do the same.
  • To implement full 3D rotation for 3D Shape (including physics) add the free Rotate 3D behavior to 3DShape.
  • With both behaviors used together, the Z angle can still be overridden by C3 behavior and ACEs and the X,Y rotation will be controlled by physics.
Performance
  • Use collision filter group and mask to limit the number of collision checks. For example in a platformer, immovable terrain does not need to be able to collide with itself. See the suggestions in the collisioFilter.txt file from Foozle.
  • Also use filter group and mask with with raycast if it is used often.

Example rayacastExample-mouselook courtesy of: Fodi

Note versions 2.x.x use an experimental rapier physics engine with limited features.

StatusIn development
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(4 total ratings)
Authorkindeyegames
Made withConstruct
Tagsconstruct-3

Purchase

Buy Now$10.00 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $10 USD. You will get access to the following files:

raycastExample.c3p 1,013 kB
OnCollision-1-0-1.c3p 109 kB
raycastExample-mouselook.c3p 567 kB
collisionFilter.txt 5 kB
mikal_cannon_3d_physics-1.11.0.c3addon 84 kB
PhysicsAndRotate.c3p 1 MB
Raycast triggers.c3p 1,013 kB
spring.c3p 109 kB
Heightfield.c3p 200 kB
ssao-1-6-0.c3addon 6 kB
3DObjectPhysics.c3p 7 MB
mikal_cannon_3d_physics-1.18.0.c3addon 87 kB
mikal_physics_render-1.0.0.c3addon 6 kB
mikal_cannon_3d_physics-1.19.1.c3addon 87 kB

Development log

View all posts

Comments

Log in with itch.io to leave a comment.

this is real power plugin! it can help me creat a real world


greetings On the page with SSO effect, when the opacity of the object decreases, it becomes black 

Deleted 35 days ago
Deleted 35 days ago

You should apply SSAO effect to a layer, is that what you do? Also note that effects directly on rotate3d objects will likely not look correct as mentioned on the rotate 3d itch page.

If I pledge a considerable amount of money, can you implement the following: 3D collider from 2D collision polygon (mesh), extruded on Z-Axis by a given z-height?

(1 edit)

Do you really need the x,y grid to be variable? Otherwise, you can use the heightfield shape that was just added to sprite mesh - check it out.

https://kindeyegames.itch.io/construct-3-cannon/devlog/635793/add-heightfield-sh...

If heightfeild does not work, can you show some screencaps about what you are looking for? (Sadly the cannon-es trimesh shape is not fully implemented it doesn't collide with the majority of other shapes.)

(1 edit)

I construct an extruded 3d object at runtime from a mesh-distorted tiled background (creating mesh-distorted tiled backgrounds per outer edge)

I need the sewn-together 3d frankenstein object to check against collisions and raycasts.



Can you provide a sample project with this geometry, so I can look in more detail and get a feeling for the scope (and how to do it, since the physics trimesh doesn't work.)

https://drive.google.com/file/d/1J1ERc4qsMEnviZXoH06LS_4_NvRxGHE_/view?usp=drive...

Dang - I don't have some of those addons. Can you make a project where they are bundled?

is the  ssao-1-5-1 addon the same as Mikal_SSAO_Color? some examples are telling me I need it. but I can't find it

Ah, they are different, if you have 3DObject, it is available there.

If you let me know which example(s) has it, I'll check and swap it out for the 1-5-1 version.

PhysicsAndRotate
spring and Raycast_Triggers can't open saying that it's not a valid c3c file

Added SSAO-1-6-0.c3addon, please try that (and latest physics addon and c3 beta) - for Raycast Triggers

(3 edits)

Hey Mikal! So far I’m absolutely loving this addon. I’m trying to build a super simple first person 3D platformer template and I’m using the Set velocity action for moving the player around on the X/Y plane but I don’t want to set the Z velocity with this action. (My plan is to use Z impulses for jumping later).

Can you please add expressions for the Canon3DPhysics behaviour that just return the object’s current X/Y/Z velocity? Because then I could just set the Z velocity in this action to Self.Canon3DPhysics.VelocityZ to leave it as it is.

Or alternatively three different actions to set the only the X, only the Y or only the Z velocity separately would also work perfectly.

Thanks a bunch!

I'll add it to the list.

Awesome, thanks!

cool

Wow... will definitely buy and play with it this week. I feel like I have to remake my game now since all my characters are blob monsters and this will work so well........ so much work lol.

I guess this is a good alternative to heightmaps for slopes?

cool  ! thinking of replacing all my enemies with this now. will this use deltatime by default in the future?right now  even adding *dt to impulse give different speed at 60hz and 144hz

Yes, definitely will have that option in the future.

A suggestion: Can you add Apply Force features too and a tick option to prevent or not prevent rotation of 3d Shape?

I will add to the list, also support to control rotation 

In terms of prevent rotation of 3D Shape, can you provide more information about what you mean?

I mean locking angle features(toggle) of 3d shape with 3d physics behavior enabled. I was trying to make custom physics control to the 3d shape and I added if key down -> apply impulse. But it seems that when this 3d shape collide with immovable 3d physics surface its angle also changes.

I see. I'll add it to the list.

Absolutely brilliant stuff, I especially love the raycast feature.

Thank you, if you doing something fun with let me know!

That paid version and all those features is an auto buy. 50-100 dollars is a fair price if 3d Object can rotate on all axis.

3D Object will be able to rotate on all axis, figuring out collision options for 3DObject: manual sized sphere, box, automatically sized sphere box (based on initial bounding box, I don't think dynamically updated)

More advanced (and heavier perf) cylinder:


const radiusTop = 0.5
const radiusBottom = 0.5
const height = 2
const numSegments = 12 (more, more perf)
const cylinderShape = new CANNON.Cylinder(radiusTop, radiusBottom, height, numSegments)

(1 edit)

Would buy this so fast just for the raycast alone.

Incredibly exciting. Love your 3DObject already, so this is going to be a gamechanger. 

🔥🔥🔥

its gonna be more great if can work with your 3D Object plugin, amazing work!

(+2)

Your are genious man! I am very thankful that you have your attention on 3d physics too. I am really excited to see more updates on future. You are doing great man.