Replies: 4 comments 6 replies
|
A possible API usage for the Finite Element Entity Simulation State Update. # get feature
importer:FiniteElementStateImportFeature = world.features().find(FiniteElementStateImportFeature)
# create a geometry to update the state
state_geo = importer.create_geometry(vertex_offset=0, vertex_count=N)
# say: need to update position
pos = state_geo.vertices().create(builtin.position)
view(pos)[:] = np.array([...])
# say: need to update velocity
velocity = state_geo.vertices().create(builtin.velocity)
view(velocity)[:] = 0 # say, set speed to 0
# apply the update
importer.copy_from(state_geo) # copy the provided information from the state_geo (now, positions and velocities)A possible API usage for the Affine Body Entity Simulation State Update # get feature
importer:AffineBodyStateImportFeature = world.features().find(AffineBodyStateImportFeature)
# create a geometry to update the state
state_geo = importer.create_geometry(body_offset=0, body_count=N)
# say: need to update transform
trans = state_geo.instances().create(builtin.transform)
view(trans)[:] = np.array([...])
# say: need to update velocity
velocity = state_geo.instances().create(builtin.velocity)
view(velocity)[:] = 0 # say, set speed to 0
# apply the update
importer.copy_from(state_geo) # copy the provided information from the state_geo (now, transform and velocities) |
4 replies
|
So I think it's better to separate the functionalities to:
The 1 will be implemented first, and 2,3 need further discussion. For now, I will expose the World-Sanity-Check facility to users as a temporary workaround, which means users can call: world.sanity_check()after state update. |
2 replies
|
A possible API usage for the Finite Element Entity Simulation State Update. # get feature
accessor:FiniteElementStateAccessorFeature = world.features().find(FiniteElementStateAccessorFeature)
# create a geometry to update the state
state_geo = accessor.create_geometry(vertex_offset=0, vertex_count=N)
# say: need to update position
pos = state_geo.vertices().create(builtin.position)
view(pos)[:] = np.array([...])
# say: need to update velocity
velocity = state_geo.vertices().create(builtin.velocity)
view(velocity)[:] = 0 # say, set speed to 0
# apply the update
accessor.copy_from(state_geo) # copy the provided information from the state_geo (now, positions and velocities)A possible API usage for the Affine Body Entity Simulation State Update # get feature
accessor:AffineBodyStateAccessorFeature = world.features().find(AffineBodyStateAccessorFeature)
# create a geometry to update the state
state_geo = accessor.create_geometry(body_offset=0, body_count=N)
# say: need to update transform
trans = state_geo.instances().create(builtin.transform)
view(trans)[:] = np.array([...])
# say: need to update velocity
velocity = state_geo.instances().create(builtin.velocity)
view(velocity)[:] = 0 # say, set speed to 0
# apply the update
accessor.copy_from(state_geo) # copy the provided information from the state_geo (now, transform and velocities) |
0 replies
Examplehttps://github.com/spiriMirror/libuipc-samples/tree/main/python/31_state_accessor_feature Resultsstate_accessor.mp4 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Related PR(last): #230
Related PR(new): #232
We are attempting to add a new
uipc::Featureto support per-object parameter updates and DOF (simulation state) updates.Discussion:
All reactions