-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
More bit gltf components #5894
More bit gltf components #5894
Conversation
const spawnerExitQuery = exitQuery(defineQuery([ObjectSpawner])); | ||
export function objectSpawnerSystem(world: HubsWorld) { | ||
interactedSpanersEnterQuery(world).forEach(spawner => { | ||
if (!jobs.has(spawner)) jobs.set(spawner, coroutine(spawnObjectJob(world, spawner))); |
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.
Might be good to use the same language to describe these things across all the coroutine-powered systems:
jobs : Map<EntityID, Coroutine>()
function* doTheThingJob
(instead offunction* doTheThing
)
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.
The ritual of each system managing these also feels a bit silly.
@@ -63,7 +63,20 @@ export function inflateModel(world: HubsWorld, rootEid: number, { model }: Model | |||
const components = obj.userData.gltfExtensions?.MOZ_hubs_components || {}; | |||
if (components.visible) { | |||
const { visible } = components.visible; | |||
obj.visible = !!visible; | |||
obj.visible = visible; |
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.
Is this value validated to be true
or false
(and never something like 0
)? (I don't remember why we wrote !!visible
but we may want a non-boolean value to throw or be converted to false
.)
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.
The visible
component has 1 property visible
which is a boolean. We technically don't validate component schemas anywhere, but if we want to it should probably be upstream from here.
ObjectSpawner.src[eid] = APP.getSid(props.src); | ||
ObjectSpawner.flags[eid] = props.mediaOptions?.applyGravity ? OBJECT_SPAWNER_FLAGS.APPLY_GRAVITY : 0; | ||
|
||
// TODO rigidbody+shape for hand grabbing |
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 may encounter the moveTheParentNotTheMesh
problem when we do this, since that had to do with where the mesh was relative to the object root (and needing the physics shape to be centered around the object's center-of-mass) .
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.
Ah perhaps. It should hopefully be much more straightforward though. We also may be able to avoid that whole class of problem if we rethink physics shapes a bit.
const nextFramePromise = Promise.resolve(); | ||
export function nextFrame() { | ||
return nextFramePromise; | ||
} |
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.
The name nextFrame
is a little weird to me, since it assumes information about the calling context (i.e. this coroutine that ticks every frame). It's accurate everywhere we've wanted to use it, but still weird to me. I don't have a better name in mind though.
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.
Yeah. This is part of the "courtine API" like timers stuff we experimented with so I guess I will add cr
. I don't like that much either but at least its consistent. Maybe we want to do something like Coroutine.nextFrame()
src/utils/network-schemas.ts
Outdated
} | ||
|
||
export const schemas: Map<Component, NetworkSchema> = new Map(); | ||
schemas.set(NetworkedMediaFrame, NetworkedMediaFrameSchema); | ||
schemas.set(NetworkedTransform, NetworkedTransformSchema); | ||
schemas.set(NetworkedVideo, NetworkedVideoSchema); | ||
schemas.set(NetworkedWaypoint, NetworkedWaypointSchema); | ||
schemas.set(NetworkedFloatyObject, { | ||
componentName: "floaty-object", |
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.
Should this be networked-floaty-object
? (I guess the networked-
prefix might be implied... I wasn't as clever with any of the other ones so they all have networked-
in their names.)
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.
No strong opinions here. Would like to get rid of this somehow as its just another thing you may mess up on copy/paste when making a new component (I almost screwed up matching the two instances of NetworkedFloatyObject
in this block.
serializeForStorage: (eid: EntityID) => StoredComponent; | ||
deserializeFromStorage: (eid: EntityID, storedComponent: StoredComponent) => void; | ||
serializeForStorage?: (eid: EntityID) => StoredComponent; | ||
deserializeFromStorage?: (eid: EntityID, storedComponent: StoredComponent) => void; |
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.
👍
2825e32
to
71abd34
Compare
Author: netpro2k <netpro2k@gmail.com>
71abd34
to
8539cd2
Compare
This PR implements
skybox
,fog
,background
,shadow
,spawn-point
andspawner
components in BitECS. Most of them are considered deprecated, but are needed for loading many existing scenes.The spawner component still needs a bit of work to be grabbable with VR hands, but this requires deeper work on the physics integration into BitECS so leaving that for a later PR.