-
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
Fix spawner issues #6158
Fix spawner issues #6158
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,13 @@ import { | |
HandCollisionTarget, | ||
ObjectSpawner, | ||
RemoteHoverTarget, | ||
SingleActionButton | ||
SingleActionButton, | ||
TogglesHoveredActionSet | ||
} from "../bit-components"; | ||
import { OBJECT_SPAWNER_FLAGS } from "../bit-systems/object-spawner"; | ||
import { COLLISION_LAYERS } from "../constants"; | ||
import { inflateMediaLoader } from "./media-loader"; | ||
import { inflateRigidBody } from "./rigid-body"; | ||
import { Type, inflateRigidBody } from "./rigid-body"; | ||
|
||
export interface SpawnerParams { | ||
src: string; | ||
|
@@ -22,7 +23,7 @@ export interface SpawnerParams { | |
export function inflateSpawner(world: HubsWorld, eid: number, props: SpawnerParams) { | ||
inflateMediaLoader(world, eid, { | ||
src: props.src, | ||
recenter: false, | ||
recenter: true, | ||
resize: false, | ||
animateLoad: false, | ||
isObjectMenuTarget: false | ||
|
@@ -32,13 +33,15 @@ export function inflateSpawner(world: HubsWorld, eid: number, props: SpawnerPara | |
addComponent(world, CursorRaycastable, eid); | ||
addComponent(world, RemoteHoverTarget, eid); | ||
addComponent(world, SingleActionButton, eid); | ||
addComponent(world, TogglesHoveredActionSet, eid); | ||
|
||
addComponent(world, ObjectSpawner, eid); | ||
ObjectSpawner.src[eid] = APP.getSid(props.src); | ||
ObjectSpawner.flags[eid] = props.mediaOptions?.applyGravity ? OBJECT_SPAWNER_FLAGS.APPLY_GRAVITY : 0; | ||
|
||
inflateRigidBody(world, eid, { | ||
mass: 0, | ||
type: Type.STATIC, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question for my study: Spawner object should be static (no local matrix update except for initialization) so rigid body type should be static. Is my understanding correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's my understanding. Spawners are static as their main action is to spawn an object and are not draggable. Also that's how we were setting them up in AFrame: |
||
collisionGroup: COLLISION_LAYERS.DEFAULT_SPAWNER, | ||
collisionMask: COLLISION_LAYERS.INTERACTABLES, | ||
disableCollision: true | ||
|
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.
Question for my study: Here can be removed because of
animateLoad: true
?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.
Yes, as we are already animating the spawned object I don't see the point on animating explicitly.