Skip to content

Commit

Permalink
Merge pull request #20 from croquet/merge-develop
Browse files Browse the repository at this point in the history
Merge develop
  • Loading branch information
ceedeepee authored Apr 9, 2024
2 parents 3a1debc + d1f3896 commit cd86476
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 102 deletions.
6 changes: 3 additions & 3 deletions unity/Assets/CroquetJS/tutorial8/Models.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Tutorial 8 Models

import { Actor, mix, AM_Spatial, AM_Behavioral, Behavior, sphericalRandom, v3_add, UserManager, User, AM_Avatar } from "@croquet/worldcore-kernel";
import { Actor, mix, AM_Spatial, AM_Drivable, AM_Behavioral, Behavior, sphericalRandom, v3_add, UserManager, User } from "@croquet/worldcore-kernel";
import { GameModelRoot } from "@croquet/game-models";

//------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -92,9 +92,9 @@ ColorActor.register('ColorActor');
//-- AvatarActor ----------------------------------------------------------------------------
//------------------------------------------------------------------------------------------

// AvatarActor includes the AM_Avatar mixin. Avatars have a driver property that holds the viewId of the user controlling them.
// AvatarActor includes the AM_Drivable mixin. Drivables have a driver property that holds the viewId of the user controlling them.

class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Avatar) {
class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Drivable) {
get gamePawnType() { return "tutorial8Avatar" }

get color() { return this._color || [0.5, 0.5, 0.5] }
Expand Down
10 changes: 7 additions & 3 deletions unity/Assets/CroquetJS/tutorial9/Models.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Tutorial 9 Models

import { Actor, mix, AM_Spatial, AM_Behavioral, Behavior, sphericalRandom, v3_add, v3_sub, v3_normalize, UserManager, User, AM_Avatar, q_axisAngle, toRad } from "@croquet/worldcore-kernel";
import { Actor, mix, AM_Spatial, AM_Drivable, AM_Behavioral, Behavior, sphericalRandom, v3_add, v3_sub, v3_normalize, UserManager, User, q_axisAngle, toRad } from "@croquet/worldcore-kernel";
import { GameModelRoot } from "@croquet/game-models";

//------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -91,7 +91,7 @@ ColorActor.register('ColorActor');

// AvatarActor includes the AM_Avatar mixin. Avatars have a driver property that holds the viewId of the user controlling them.

class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Avatar) {
class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Drivable) {
get gamePawnType() { return "tutorial9Avatar" }

get color() { return this._color || [-1, 0, 0] }
Expand All @@ -115,7 +115,11 @@ class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Avatar) {
beShoved(v) {
const translation = v3_add(this.translation, v);
if (this.driver) {
this.snap({ translation });
// the C4U bridge normally filters out all updates to a locally
// driven gameObject from its own actor. override that filtering
// explicitly, so that even the view that normally drives this
// avatar is updated.
this.snapOverridingDriver({ translation });
} else {
this.set({ translation });
}
Expand Down
8 changes: 0 additions & 8 deletions unity/Assets/Plugins.meta

This file was deleted.

21 changes: 0 additions & 21 deletions unity/Assets/Plugins/websocket-sharp-LICENSE.txt

This file was deleted.

7 changes: 0 additions & 7 deletions unity/Assets/Plugins/websocket-sharp-LICENSE.txt.meta

This file was deleted.

Binary file removed unity/Assets/Plugins/websocket-sharp.dll
Binary file not shown.
33 changes: 0 additions & 33 deletions unity/Assets/Plugins/websocket-sharp.dll.meta

This file was deleted.

2 changes: 1 addition & 1 deletion unity/Assets/Prefabs/WoodBlocks/tutorial8Avatar.prefab

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

2 changes: 1 addition & 1 deletion unity/Assets/Prefabs/WoodBlocks/tutorial9Avatar.prefab

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

2 changes: 1 addition & 1 deletion unity/Assets/Scenes/tutorial3.unity

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

4 changes: 2 additions & 2 deletions unity/Assets/Scenes/tutorial8.unity

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

4 changes: 2 additions & 2 deletions unity/Assets/Scenes/tutorial9.unity

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

8 changes: 4 additions & 4 deletions unity/Assets/Scripts/AssignFollowCamTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
public class AssignFollowCamTarget : MonoBehaviour
{
public FollowCam followCamToUpdate;

void Start()
{

}

// Update is called once per frame
void Update()
{
CroquetAvatarComponent a = CroquetAvatarSystem.Instance.GetActiveAvatarComponent();
CroquetDrivableComponent a = CroquetDrivableSystem.Instance.GetActiveDrivableComponent();

if ( a != null)
{
followCamToUpdate.target = a.transform;
Expand Down
10 changes: 5 additions & 5 deletions unity/Assets/Scripts/MouseLookAvatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ public class MouseLookAvatar : MonoBehaviour
private float pitch = 0;

private int croquetHandle;
private CroquetAvatarComponent croquetAvatarComponent;
private CroquetDrivableComponent croquetAvatarComponent;

private bool isActiveAvatarLastFrame = false;

void Start()
{
croquetHandle = GetComponent<CroquetEntityComponent>().croquetHandle;
croquetAvatarComponent = gameObject.GetComponent<CroquetAvatarComponent>();
croquetAvatarComponent = gameObject.GetComponent<CroquetDrivableComponent>();
avatarCamera = Camera.main;
}

void Update()
{
CroquetAvatarComponent activeAvatar = CroquetAvatarSystem.Instance.GetActiveAvatarComponent();
CroquetDrivableComponent activeAvatar = CroquetDrivableSystem.Instance.GetActiveDrivableComponent();
if (croquetAvatarComponent != activeAvatar)
{
isActiveAvatarLastFrame = false;
Expand Down Expand Up @@ -175,7 +175,7 @@ void Drive()
trans.localPosition = newPos;
trans.localRotation = yawQ;

CroquetSpatialSystem.Instance.SnapObjectTo(croquetHandle, newPos, yawQ);
CroquetSpatialSystem.Instance.SnapObjectInCroquet(croquetHandle, newPos, yawQ);
CroquetSpatialSystem.Instance.DrivePawn(croquetHandle, newPos, yawQ);
CroquetSpatialSystem.Instance.DriveActor(croquetHandle, false, newPos, yawQ);
}
}
10 changes: 5 additions & 5 deletions unity/Assets/Scripts/OverheadAvatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ public class OverheadAvatar : MonoBehaviour
private int right = 0;

private int croquetHandle;
private CroquetAvatarComponent croquetAvatarComponent;
private CroquetDrivableComponent croquetAvatarComponent;

void Start()
{
croquetHandle = gameObject.GetComponent<CroquetEntityComponent>().croquetHandle;
croquetAvatarComponent = gameObject.GetComponent<CroquetAvatarComponent>();
croquetAvatarComponent = gameObject.GetComponent<CroquetDrivableComponent>();
// Debug.Log($"OverheadAvatar on {croquetHandle}");
}

void Update()
{
CroquetAvatarComponent activeAvatar = CroquetAvatarSystem.Instance.GetActiveAvatarComponent();
CroquetDrivableComponent activeAvatar = CroquetDrivableSystem.Instance.GetActiveDrivableComponent();
if (croquetAvatarComponent != activeAvatar)
{
return;
Expand Down Expand Up @@ -110,7 +110,7 @@ void Drive()
Vector3 tt = newRot * t;
Vector3 newPos = transform.localPosition + tt;

CroquetSpatialSystem.Instance.SnapObjectTo(croquetHandle, newPos, newRot);
CroquetSpatialSystem.Instance.SnapObjectInCroquet(croquetHandle, newPos, newRot);
CroquetSpatialSystem.Instance.DrivePawn(croquetHandle, newPos, newRot);
CroquetSpatialSystem.Instance.DriveActor(croquetHandle, false, newPos, newRot); // false => no "snap"
}
}
4 changes: 2 additions & 2 deletions unity/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"com.unity.addressables": "1.19.19",
"com.unity.collab-proxy": "2.0.0",
"com.unity.ide.rider": "3.0.18",
"com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.ide.vscode": "1.2.5",
"com.unity.inputsystem": "1.5.0",
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.6.4",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.8.0",
"io.croquet.multiplayer": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.0",
"io.croquet.multiplayer": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.3",
"net.gree.unity-webview": "https://github.com/gree/unity-webview.git?path=/dist/package-nofragment",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions unity/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.17",
"version": "2.0.22",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -121,14 +121,14 @@
"url": "https://packages.unity.com"
},
"io.croquet.multiplayer": {
"version": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.0",
"version": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.3",
"depth": 0,
"source": "git",
"dependencies": {
"com.unity.addressables": "1.19.19",
"com.unity.inputsystem": "1.5.0"
},
"hash": "9bddf70f2e43a0ef777ac04e8fcf6a15bfcc322e"
"hash": "bbee80e755e85fbc0ec84fe4d02682df676d650f"
},
"net.gree.unity-webview": {
"version": "https://github.com/gree/unity-webview.git?path=/dist/package-nofragment",
Expand Down
2 changes: 1 addition & 1 deletion unity/ProjectSettings/ProjectSettings.asset

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

0 comments on commit cd86476

Please sign in to comment.