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

Intake and Ejector Configurator #1017

Merged
merged 49 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
98caf9f
Adding configure pickup in panelui
Dhruv-0-Arora Jul 3, 2024
b8ccf13
Merge remote-tracking branch 'origin/dhruv/1733/mirabuf-gizmo' into d…
Dhruv-0-Arora Jul 3, 2024
be8c4d0
Merge branch 'dhruv/1733/mirabuf-gizmo' into dhruv/1728/intake-ejecto…
Dhruv-0-Arora Jul 3, 2024
6196bb5
Merge remote-tracking branch 'origin/dhruv/1733/mirabuf-gizmo' into d…
Dhruv-0-Arora Jul 4, 2024
4d05972
Added transform gizmo bug fixes and also cancel functionality
Dhruv-0-Arora Jul 4, 2024
2810af4
Readded slider for sizing and configuration for the slider
Dhruv-0-Arora Jul 8, 2024
2f70b40
Merging dev
Dhruv-0-Arora Jul 8, 2024
72949b5
Merge branch 'dhruv/1733/mirabuf-gizmo' into dhruv/1728/intake-ejecto…
Dhruv-0-Arora Jul 8, 2024
e7da8c3
Quick fix
Dhruv-0-Arora Jul 8, 2024
bcc4e87
Merge remote-tracking branch 'origin/barclah/1682/mouse-interaction' …
Dhruv-0-Arora Jul 8, 2024
09faae5
Merge branch 'dhruv/1733/mirabuf-gizmo' into dhruv/1728/intake-ejecto…
Dhruv-0-Arora Jul 8, 2024
7ed6995
Added scaling functionality with slider
Dhruv-0-Arora Jul 8, 2024
49b9e5e
Raycasting work and basic implementation of pickup configuration
Dhruv-0-Arora Jul 9, 2024
518c7c5
Merge remote-tracking branch 'origin/dev' into dhruv/1728/intake-ejec…
Dhruv-0-Arora Jul 9, 2024
866936d
Added storing data functionality
Dhruv-0-Arora Jul 9, 2024
39c1316
Added configuration for shot trajectory
Dhruv-0-Arora Jul 9, 2024
cdbf94c
Merge remote-tracking branch 'origin/barclah/1682/mouse-interaction' …
Dhruv-0-Arora Jul 10, 2024
d29f443
Merge remote-tracking branch 'origin/dhruv/1733/mirabuf-gizmo' into d…
Dhruv-0-Arora Jul 10, 2024
85ed61a
Bug fix + ran prettier + fixed transform gizmo size from merge
Dhruv-0-Arora Jul 10, 2024
8f5b1da
Merge branch 'haverty/1692/preferences' into dhruv/1728/intake-ejecto…
LucaHaverty Jul 10, 2024
88b1ea3
Prevented select node from selecting a field or the ground
Dhruv-0-Arora Jul 10, 2024
6c0b41d
Ejector and intake config integration with preferences
LucaHaverty Jul 10, 2024
b546b3a
Merge branch 'dhruv/1728/intake-ejector-config' of github.com:autodes…
LucaHaverty Jul 10, 2024
56e38de
Ran prettier
Dhruv-0-Arora Jul 10, 2024
f7a9c90
Created a working formula to calculate the position of the pickup object
Dhruv-0-Arora Jul 12, 2024
1e74985
Add documentation + fixed the fields showing in the select panel + op…
Dhruv-0-Arora Jul 12, 2024
25422d4
Fixed filtering robots and fields + reimplemented the selectNode feature
Dhruv-0-Arora Jul 12, 2024
bb15c58
Optimized getting rotation and added implementation for configuring t…
Dhruv-0-Arora Jul 12, 2024
c2c0c3b
Merge remote-tracking branch 'origin/dev' into dhruv/1728/intake-ejec…
Dhruv-0-Arora Jul 12, 2024
040eed6
Solved gizmo transformation delta issue for ejector configuration.
HunterBarclay Jul 13, 2024
e2bd3fb
Updated intake preferences and copied ejector over to intake. Minor t…
HunterBarclay Jul 13, 2024
f62ce24
Formatted
HunterBarclay Jul 13, 2024
90f183b
Added new gamepiece association for detecting gamepieces
HunterBarclay Jul 13, 2024
1ba2663
Added intake sensor
HunterBarclay Jul 13, 2024
c110cf0
Ejectables done
HunterBarclay Jul 14, 2024
61d0b1f
Adjusted max ejection velocity
HunterBarclay Jul 14, 2024
e986aa4
Merge branch 'haverty/1692/preferences' into dhruv/1728/intake-ejecto…
HunterBarclay Jul 14, 2024
cbe34c8
Fixed label for intake size
HunterBarclay Jul 14, 2024
ccfb830
Formatted
HunterBarclay Jul 14, 2024
ae6a9df
Merge branch 'haverty/1692/preferences' into dhruv/1728/intake-ejecto…
HunterBarclay Jul 14, 2024
3e3a437
Merge branch 'dev' into dhruv/1728/intake-ejector-config
HunterBarclay Jul 15, 2024
7247694
Renamed BodyAssociated to BodyAssociate, made requested changes.
HunterBarclay Jul 15, 2024
f6495e7
Adding unit tests
HunterBarclay Jul 15, 2024
764749e
Fixed poker slider error
Dhruv-0-Arora Jul 15, 2024
f75fc6b
Merge remote-tracking branch 'origin/dev' into dhruv/1728/intake-ejec…
Dhruv-0-Arora Jul 15, 2024
46c49fa
Formatting
Dhruv-0-Arora Jul 15, 2024
0fc72c8
Fixing body associates
HunterBarclay Jul 15, 2024
14e878d
Removed unused var eslint complaint
a-crowell Jul 15, 2024
1b18b3f
made requested change
HunterBarclay Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fission/src/mirabuf/IntakeSensorSceneObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class IntakeSensorSceneObject extends SceneObject {
// TEMPORARY GAME PIECE DETECTION
const hitRes = World.PhysicsSystem.RayCast(ThreeVector3_JoltVec3(position), new JOLT.Vec3(0, 0, 3))
if (hitRes) {
const gpAssoc = World.PhysicsSystem.GetBodyAssociation<RigidNodeAssociate>(hitRes.data.mBodyID)
const gpAssoc = <RigidNodeAssociate>World.PhysicsSystem.GetBodyAssociation(hitRes.data.mBodyID)
// This works, however the check for game piece is doing two checks.
if (gpAssoc && gpAssoc.isGamePiece) {
HunterBarclay marked this conversation as resolved.
Show resolved Hide resolved
console.debug("Found game piece!")
this._parentAssembly.SetEjectable(hitRes.data.mBodyID, false)
Expand Down
5 changes: 2 additions & 3 deletions fission/src/mirabuf/MirabufSceneObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { JoltMat44_ThreeMatrix4 } from "@/util/TypeConversions"
import * as THREE from "three"
import JOLT from "@/util/loading/JoltSyncLoader"
import { BodyAssociate, JoltBodyIndexAndSequence, LayerReserve } from "@/systems/physics/PhysicsSystem"

Check warning on line 10 in fission/src/mirabuf/MirabufSceneObject.ts

View workflow job for this annotation

GitHub Actions / ESLint Format Validation

'JoltBodyIndexAndSequence' is defined but never used. Allowed unused vars must match /^_/u
a-crowell marked this conversation as resolved.
Show resolved Hide resolved
import Mechanism from "@/systems/physics/Mechanism"
import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain"
import InputSystem from "@/systems/input/InputSystem"
Expand Down Expand Up @@ -359,8 +359,7 @@
/**
* Body association to a rigid node with a given mirabuf scene object.
*/
export class RigidNodeAssociate implements BodyAssociate {
public readonly associatedBody: JoltBodyIndexAndSequence
export class RigidNodeAssociate extends BodyAssociate {
public readonly sceneObject: MirabufSceneObject

public readonly rigidNode: RigidNodeReadOnly
Expand All @@ -373,9 +372,9 @@
}

public constructor(sceneObject: MirabufSceneObject, rigidNode: RigidNodeReadOnly, body: Jolt.BodyID) {
super(body)
this.sceneObject = sceneObject
this.rigidNode = rigidNode
this.associatedBody = body.GetIndexAndSequenceNumber()
}
}

Expand Down
16 changes: 7 additions & 9 deletions fission/src/systems/physics/PhysicsSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,8 @@ class PhysicsSystem extends WorldSystem {
* @param bodyId BodyID to check for association
* @returns Association for given Body
*/
public GetBodyAssociation<T extends object & BodyAssociate>(bodyId: Jolt.BodyID): T | undefined {
const res = this._bodyAssociations.get(bodyId.GetIndexAndSequenceNumber())
if (res) {
// Avoids error, simply returns undefined if invalid
return res as unknown as T
} else {
return res
}
public GetBodyAssociation(bodyId: Jolt.BodyID): BodyAssociate | undefined {
return this._bodyAssociations.get(bodyId.GetIndexAndSequenceNumber())
}

/**
Expand Down Expand Up @@ -1127,8 +1121,12 @@ export type RayCastHit = {
/**
* An interface to create an association between a body and anything.
*/
export interface BodyAssociate {
export class BodyAssociate {
readonly associatedBody: JoltBodyIndexAndSequence

public constructor(bodyId: Jolt.BodyID) {
this.associatedBody = bodyId.GetIndexAndSequenceNumber()
}
}

export default PhysicsSystem
44 changes: 1 addition & 43 deletions fission/src/test/PhysicsSystem.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect, describe, assert } from "vitest"
import PhysicsSystem, { BodyAssociate, LayerReserve } from "../systems/physics/PhysicsSystem"
import PhysicsSystem, { LayerReserve } from "../systems/physics/PhysicsSystem"
import MirabufParser from "@/mirabuf/MirabufParser"
import * as THREE from "three"
import Jolt from "@barclah/jolt-physics"
Expand Down Expand Up @@ -100,45 +100,3 @@ describe("Mirabuf Physics Loading", () => {
expect(mapping.size).toBe(10)
})
})

describe("Body Association", () => {
const B_SAMPLE_NUMBER = 52
const C_SAMPLE_NUMBER = 24

class A implements BodyAssociate {
public associatedBody: number
public sampleBoolean: boolean

public constructor(bodyId: Jolt.BodyID) {
this.associatedBody = bodyId.GetIndexAndSequenceNumber()
this.sampleBoolean = true
}
}

class B implements BodyAssociate {
public associatedBody: number
public sampleNumber: number

public constructor(bodyId: Jolt.BodyID) {
this.associatedBody = bodyId.GetIndexAndSequenceNumber()
this.sampleNumber = B_SAMPLE_NUMBER
}
}

class C extends A {
public sampleNumber: number

public constructor(bodyId: Jolt.BodyID) {
super(bodyId)
this.sampleNumber = C_SAMPLE_NUMBER
}
}

test("Simple Association", () => {
const physSystem = new PhysicsSystem()
const boxA = physSystem.CreateBox(new THREE.Vector3(1, 1, 1), undefined, undefined, undefined)
physSystem.AddBodyToSystem(boxA.GetID(), true)

physSystem.SetBodyAssociation(new A(boxA.GetID()))
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ const ConfigureGamepiecePickupPanel: React.FC<PanelPropsImpl> = ({ panelId, open
return false
}

const assoc = World.PhysicsSystem.GetBodyAssociation<RigidNodeAssociate>(body)
if (assoc?.sceneObject != selectedRobot) {
const assoc = World.PhysicsSystem.GetBodyAssociation(body) as RigidNodeAssociate
if (!assoc || !assoc.sceneObject || assoc.sceneObject != selectedRobot) {
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ const ConfigureShotTrajectoryPanel: React.FC<PanelPropsImpl> = ({ panelId, openL
return false
}

const assoc = World.PhysicsSystem.GetBodyAssociation<RigidNodeAssociate>(body)
if (assoc?.sceneObject != selectedRobot) {
const assoc = World.PhysicsSystem.GetBodyAssociation(body) as RigidNodeAssociate
if (!assoc || !assoc.sceneObject || assoc.sceneObject != selectedRobot) {
return false
}

Expand Down
Loading