Skip to content

Conversation

@mattmacf98
Copy link
Member

Description

This PR creates the first koota relationship for our entities and creates a hover link entity which enables directional index mapping for hover actions.

Testing

  • ran locally to ensure creation and deletion of relationships worked as expected and the directed relationship edges were independent
Screen.Recording.2026-02-09.at.2.mp4

@changeset-bot
Copy link

changeset-bot bot commented Feb 9, 2026

🦋 Changeset detected

Latest commit: 5c46a77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@viamrobotics/motion-tools Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattmacf98 mattmacf98 mentioned this pull request Feb 9, 2026
@mattmacf98 mattmacf98 requested review from DTCurrie and micheal-parks and removed request for DTCurrie and micheal-parks February 10, 2026 16:51
const y = positions[i + 1] / 1000
const z = positions[i + 2] / 1000

const distance = point.distanceToSquared(new Vector3(x, y, z))
Copy link
Collaborator

Choose a reason for hiding this comment

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

should use a pooled vector

Suggested change
const distance = point.distanceToSquared(new Vector3(x, y, z))
const distance = point.distanceToSquared(vec3.set(x, y, z))

Copy link
Member Author

Choose a reason for hiding this comment

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

ok yeah will update

y: number
z: number
}
orientation?: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
orientation?: {
direction?: {

since this isn't a true orientation

Copy link
Member Author

Choose a reason for hiding this comment

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

will update

y: 0, // World position Y in meters
z: 0, // World position Z in meters
})
export const Hover = trait(() => ({
Copy link
Collaborator

@micheal-parks micheal-parks Feb 12, 2026

Choose a reason for hiding this comment

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

I'd maybe call this trait "InstancedPose" instead, since that's what it represents (an arrow instance, a point instance within THREE.Points, other instance types in the future?). Memory layout could also be made more efficient (struct of arrays):

export const InstancedPose = trait({
  x: 0, y: 0, z: 0, ox: 0, oY: 0, oZ: 1, theta: 0, index: -1
})

Copy link
Member Author

Choose a reason for hiding this comment

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

ok yeah i can update that

provideFramelessComponents()

const { focus } = provideSelection()
provideHoveredLinkedEntities()
Copy link
Collaborator

@micheal-parks micheal-parks Feb 12, 2026

Choose a reason for hiding this comment

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

Maybe leave hovered out of the naming for all of the new introductions that involve linking?

provideLinkedEntities()

While it's true that right now that linking is visually represented only during hovering, it's totally possible in the near future this might change or other types visual feedback for linking could be introduced

Copy link
Member Author

Choose a reason for hiding this comment

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

ok yeah I can remove the hovered naming for this relationship context

import { Parser } from 'expr-eval'
import { useTrait } from '$lib/ecs'

const parser = new Parser()
Copy link
Collaborator

Choose a reason for hiding this comment

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

can probably move this to a <script module> section to avoid new parsers per entity

Copy link
Member Author

Choose a reason for hiding this comment

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

done


const displayedHoverInfo = useTrait(() => displayEntity, traits.Hover)

let hoverInfo: HoverInfo | null = $state.raw(null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let hoverInfo: HoverInfo | null = $state.raw(null)
let hoverInfo= $state.raw<HoverInfo | null>(null)

just slightly more typesafe :)

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants