Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions Assets/Dojo/InitEntities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using Dojo;
using Unity.VisualScripting;
using UnityEngine;

public class InitEntities : MonoBehaviour
{
public WorldManager worldManager;
// Start is called before the first frame update
void Start()
{
worldManager.synchronizationMaster.OnEntitySpawned += InitEntity;
foreach (var entity in worldManager.Entities())
{
InitEntity(entity);
}
}

// Update is called once per frame
void Update()
{

}

private void InitEntity(GameObject entity)
{
var capsule = GameObject.CreatePrimitive(PrimitiveType.Capsule);
// change color of capsule to a random color
capsule.GetComponent<Renderer>().material.color = Random.ColorHSV();
capsule.transform.parent = entity.transform;
}
}
11 changes: 11 additions & 0 deletions Assets/Dojo/InitEntities.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Assets/Dojo/Models/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,31 @@ public override void Initialize(Model model)
x = model.members["vec"].ty.ty_struct.children[0].ty.ty_primitive.u32;
y = model.members["vec"].ty.ty_struct.children[1].ty.ty_primitive.u32;
}

void Start()
{
var target = new Vector3(x, 0, y);
gameObject.transform.position = target;
}

void Update()
{
// our curent position is gameObject.transform.position
// move towards the target position
var step = 3.0f * Time.deltaTime;
// scale down our positions
var target = new Vector3(x, 0, y);
gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, target, step);

// if we are close enough to the target position, snap to it
if (Vector3.Distance(gameObject.transform.position, target) < 0.001f)
{
gameObject.transform.position = target;
}
}

public override void OnUpdated(Model model)
{
base.OnUpdated(model);
}
}
253 changes: 252 additions & 1 deletion Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,103 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &36216327
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 184210, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_Name
value: UnityMainThreadDispatcher
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_SizeDelta.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_SizeDelta.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchoredPosition.x
value: -50
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_AnchoredPosition.y
value: -50
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 22414968, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c3c54c612cab04d86ab0ee8c4125943d, type: 3}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -302,13 +399,164 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
serializedVersion: 2
m_LocalRotation: {x: 0.5697441, y: -0, z: -0, w: 0.82182217}
m_LocalPosition: {x: 0, y: 15.93, z: -6.8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 69.465, y: 0, z: 0}
--- !u!1 &998234499
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 998234501}
- component: {fileID: 998234500}
m_Layer: 0
m_Name: InitEntities
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &998234500
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 998234499}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 607a463b8a907498380786d00fd65442, type: 3}
m_Name:
m_EditorClassIdentifier:
worldManager: {fileID: 2019443015}
--- !u!4 &998234501
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 998234499}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalPosition: {x: 0.35532206, y: -7.8996043, z: 4.1032615}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1603019347
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1603019351}
- component: {fileID: 1603019350}
- component: {fileID: 1603019349}
- component: {fileID: 1603019348}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!64 &1603019348
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1603019347}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1603019349
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1603019347}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1603019350
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1603019347}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1603019351
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1603019347}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.059999, y: -0.05, z: -0.089867}
m_LocalScale: {x: 4.482111, y: 1, z: 3.7630765}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2019443014
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -412,3 +660,6 @@ SceneRoots:
- {fileID: 963194228}
- {fileID: 705507995}
- {fileID: 2019443016}
- {fileID: 36216327}
- {fileID: 1603019351}
- {fileID: 998234501}
Binary file modified Packages/Dojo/.DS_Store
Binary file not shown.
Binary file modified Packages/Dojo/Libraries/.DS_Store
Binary file not shown.
Binary file modified Packages/Dojo/Libraries/libtorii_c.dylib
100755 → 100644
Binary file not shown.
2 changes: 2 additions & 0 deletions Packages/Dojo/Runtime/ModelInstance.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Dojo.Torii;
using dojo_bindings;
using UnityEngine;
Expand Down
Loading