-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated the library to work with bevy 0.7 and rapier 0.13.2 #50
base: master
Are you sure you want to change the base?
Conversation
src/rapier_physics.rs
Outdated
.insert_bundle(bundle) | ||
.insert(RigidBodyPositionSync::Discrete); | ||
//new method of inserting rigid bodies into entities | ||
if body_desc.ccd_enable{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, could we get rid of this conditional here? I'd rather something like
let initial_body = commands.entity(entity)
.insert(body_status)
....
if body_desc.ccv_enable {
initial_body.insert(Ccd::enabled())
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that'd work, yeah. As I was writing the code I also found out that you can still use bundles, but you can't define them as a variable beforehand. So there's a nicer way to format the inserts. Not that it matters I suppose, since functionaly both methods are the same
Looks pretty good. I'll give it a test this weekend before merging. |
I have found an bug! The collider descriptions aren't actually added to rigid bodies, but rather, a new rigid body is created with the collider description. Causing a lot of weird stuff. I will try to fix it and update my fork. |
Please consider updating the examples. |
@@ -46,69 +46,64 @@ pub fn body_description_to_builder( | |||
for (body_desc, entity, transform) in body_desc_query.iter() { | |||
commands.entity(entity).remove::<RigidBodyDescription>(); | |||
|
|||
let isometry = Isometry3::from((transform.translation, transform.rotation)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove Isometry3 from the import list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true. I wasn't really worried about code cleanup, just wanted to get it workin.
@@ -46,69 +46,64 @@ pub fn body_description_to_builder( | |||
for (body_desc, entity, transform) in body_desc_query.iter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transform is not used anymore.
I'm getting a build error:
I've tried both updating Any thoughts? Have other people managed to build it? |
Have you tried "use bevy_rapier3d::prelude::*"? that was what worked for me. I didn't try building the examples, I only updated the library code. A friend of mine did try to build it with our game code, it worked fine. |
Hmm. Can I get you to also try it with the examples. Even with the fix for the import path (it seems I'm hesitant to merge it if it means the example doesn't work :) |
Yeah, sure, I'll have some spare time tomorrow I'll try to get the examples running |
Lights now have Visibility component. Simply adding "LIGHT" to is_present(obj) in visibility.py fixes the problem. @staticmethod
def is_present(obj):
return obj.type in [
"MESH", "LIGHT"
]` |
@YourRentIsDue, @sdfgeoff I have updated @YourRentIsDue PR in my fork to support bevy 8.1 and rapier 3d 0.18 and have something that still need a little bit more testing and polishing but looks like work good at least with my blender project. Would you like me to raise a new PR? raise a PR against @YourRentIsDue fork? Please let me know. Moving fwd I'll certainely help upgrade to bevy 0.9 as soon as I have moved my games to it. |
@bmarone Yeah, feel free to open a new PR against this repo. I'll have a look. A project has recently come my way that I'm interested in using Bevy for, so I'm also keen to get a 0.9 version of this plugin working. |
super! I have noticed a few things that are still exported incorectly from Blender that I'd like to fix, in particularly empties are not working well with the exporter and for a reason I have not looked at yet optional values are not deserialized properly on the rust side. Also I'd would to add some deserialization tests on the rust side and do the same on the python side with the caveat I don't know much about python but that might be my oportunity to learn more about it. @sdfgeoff is there a solid source of knowledge (doc, blog, book..) about developping blender addon I can refer to? |
btw thanks for starting this project, at the moment |
I'm super keen for tests - particularly on the Rust side. I'd probably just throw some end-to-end serialisation tests (this blend file -> this scene files) for the blender side of things, but have no idea how to test the rust side.
There's of course the official API, and it's pretty good with clear writing on all methods and quite a few examples, but it's a bit opaque to get into. I don't know of any good sources of practical knowledge. However I've done a few addons now, so I'll try to dump some knowledge. If you have questions, ask and I'll answer as best as I'm able. OperationsOperations tend to reside in Data/object API;sData API's tend to exist in ... Properties and storing dataThere's something magic about Blender's file format: it's a self-descriptive database. This means that if you register a custom property into an object in bpy.types.Object, then .... it'll be there when the file is re-opened! How magic is that! No need to bother storing the data yourself, just write it into the most relevant thing (scene, object, render-settings, material, whatever) and let blender do the rest. Of course, there is a small caveat - it only supports # Create a group with a bunch of properties
class ColliderDescriptionProperties(bpy.types.PropertyGroup):
present: bpy.props.BoolProperty(name="Present", default=False)
friction: bpy.props.FloatProperty(name="friction", default=0.5)
....
# Then on addon startup (inside the register function) we tell blender about this property group:
bpy.utils.register_class(ColliderDescriptionProperties)
bpy.types.Object.rapier_collider_description = bpy.props.PointerProperty(
type=ColliderDescriptionProperties
) UI'sThe cool thing about properties is that they contain everything needed to create a UI for themselves! So there's no need to set up a fancy UI for each thing you want to adjust, all you have to do is tell blender where to display the property. Eg for the point light: class PointLightPanel(bpy.types.Panel):
# Defines where to draw the panel:
bl_idname = "OBJECT_PT_point_light_properties"
bl_label = "BevyPointLight"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "physics"
@classmethod
def poll(cls, context):
# Should I render the panel?
return PointLight.is_present(context.object)
@staticmethod
def draw(self, context):
# What is contained in the panel
row = self.layout.row()
row.label(text="Provider of omnidirectional illumination")
row = self.layout.row()
row.prop(context.object.data, "color")
row = self.layout.row()
row.prop(context.object.data, "energy")
.... Because the PointLight object is registered with "Color" being a Want to know a secret? Blender's entire UI is done in python. Don't believe me? Go look in the Final NotesBeyond that, it's just normal python. You can use all of python's inbuilt libraries (eg struct, os, shutil), and pretty much do whatever you like. After implementing the godot-blender exporter and playcanvas-blender exporter, I decided that it's pretty much always a good idea to create custom properties rather than to try overload blender's properties: ie don't try to fit Rapier around Blender's internal idea of physics. Other than the fact it would be a lot of work, I'd say the same for materials: ideally I'd implement Bevy's PBR materials semi-independent from blender's material system. Blender's API's are actually even more powerful than I've described here. You can implement rendering engines that draw into the main UI! But while that would be super cool, it's probably also overkill at the moment. Hopefully that will help give a leg-up. If you have any questions, fire away. |
@bmarone I don't see your 0.8 branch in your fork of this repo. I'd love to take a look and see about getting this repo up to current bevy master. Could you push it up for me? |
any news on this? 0.9 is out :( |
Recently I investigated using GLTF as the interchange format. You can read about it here: However, to make a generic solution (where you can add your own components) would require me to understand how to write a serde deserializer. Know any good documentation on this? The official docs were a bit more complex than I could get my head around. |
Hmm. This might be worth looking deeper into, to be honest I sort of lost
interest in this project when I tried to create a collision mesh for a half
square and couldn't get it to work lol.
I would look into it deeper, but since my original update I have become
employed, making my time to work on open source projects very limited.
As for serde docks, to be honest I don't think you're going to find
anything beyond the official, which I agree is a bit daunting.
…On Sat, Nov 26, 2022 at 5:07 AM sdfgeoff ***@***.***> wrote:
Recently I investigated using GLTF as the interchange format. You can read
about it here:
#52 <#52>
This looks like a promising approach that removes a lot of complexity from
this project and would reduce the required development effort.
However, to make a generic solution (where you can add your own
components) would require me to understand how to write a serde
deserializer. Know any good documentation on this? The official docs were a
bit more complex than I could get my head around.
—
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANNXUTIFKW6XAF6EGTLMZF3WKF5G5ANCNFSM5WG7JA7Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have tested with my own project. The code compiles and the features all seem to be in working order!