Skip to content
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

Point & Click Placement Mode #10042

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open

Point & Click Placement Mode #10042

wants to merge 29 commits into from

Conversation

dinomut1
Copy link
Member

@dinomut1 dinomut1 commented Apr 4, 2024

Adds point & click mode for asset placement

@@ -49,4 +58,17 @@ export const serializeEntity = (entity: Entity) => {
return jsonComponents
}

export const toEntityJson = (entity: Entity) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried about learning on serializing the simulation layer into the authoring layer, as it will be serializing simulation side effects (such as physics simulation, runtime entities, visual script mutations etc).

Rather than this, we should

Copy link
Member Author

@dinomut1 dinomut1 Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes if this function is used incorrectly it could end up capturing side effects, but there are many cases where just fully serializing an entity is the correct course of action. We should have this function available for those cases. I'm using it in the click placement system to add the placement entity to the authoring layer, since it does (and should) only exist in the simulation layer up until the click placement event. In that case, the entity is guaranteed to only be a model component and a transform component which should be serialized directly from their runtime values, and this function is correctly called in that case.

packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.ts Outdated Show resolved Hide resolved
@HexaField HexaField marked this pull request as draft April 5, 2024 18:31
@HexaField
Copy link
Member

Screenshot from 2024-04-05 11-31-01
UI is also a bit busted

@dinomut1 dinomut1 marked this pull request as ready for review April 23, 2024 00:08
packages/editor/src/systems/ClickPlacementSystem.tsx Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.tsx Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.tsx Outdated Show resolved Hide resolved
packages/editor/src/systems/ClickPlacementSystem.tsx Outdated Show resolved Hide resolved
const sceneObjects = objectLayerQuery().flatMap((entity) => getComponent(entity, GroupComponent))
//const sceneObjects = Array.from(Engine.instance.objectLayerList[ObjectLayers.Scene] || [])
const camera = getComponent(Engine.instance.cameraEntity, CameraComponent)
const pointerScreenRaycaster = new Raycaster()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be using spatial input here, rather than a custom raycaster

@HexaField
Copy link
Member

failing checks & tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants