MasterOX 水
MasterOX 水
NNormal
Created by MasterOX 水 on 8/20/2024 in #🤝ask-a-question
can a vector 3 be synced
can a vector 3 be synced in a model?
7 replies
NNormal
Created by MasterOX 水 on 8/13/2024 in #🤝ask-a-question
calling the set function every frame
if i call the set function from a realtime component every frame with the same argument, will it try to send the data every time or just the first time
8 replies
NNormal
Created by MasterOX 水 on 8/11/2024 in #🤝ask-a-question
OnRealtimeModelReplaced is not being called
using UnityEngine;
using Normal.Realtime;
using System.Collections;
using UnityEngine.XR.Interaction.Toolkit;
public class windStormPowerUp : RealtimeComponent<windStormPowerUpModel>
{
public bool shouldStart;
public GameObject wind;
public MeshRenderer meshRenderer;
public Collider coll;
public XRGrabInteractable grab;
public ParticleSystem particles;

public float windDuration;
void Start()
{
wind = GameObject.FindGameObjectWithTag("weather").transform.GetChild(0).gameObject;
}
protected override void OnRealtimeModelReplaced(windStormPowerUpModel previousModel, windStormPowerUpModel currentModel) {
print("test");
if (previousModel != null) {
previousModel.startedDidChange -= StartedDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.started = shouldStart;
}
UpdateStarted();
currentModel.startedDidChange += StartedDidChange;
}
}
private void StartedDidChange(windStormPowerUpModel model, bool value) {
UpdateStarted();
}
private void UpdateStarted() {
shouldStart= model.started;
print("get");
if(shouldStart)
{
meshRenderer.enabled = false;
coll.enabled = false;
grab.enabled=false;
particles.Stop();
StartCoroutine(windForce(windDuration));
}
else
{
wind.gameObject.SetActive(false);
}
}
public void SetStarted(bool started) {
model.started = started;
print("set");
}

}
using UnityEngine;
using Normal.Realtime;
using System.Collections;
using UnityEngine.XR.Interaction.Toolkit;
public class windStormPowerUp : RealtimeComponent<windStormPowerUpModel>
{
public bool shouldStart;
public GameObject wind;
public MeshRenderer meshRenderer;
public Collider coll;
public XRGrabInteractable grab;
public ParticleSystem particles;

public float windDuration;
void Start()
{
wind = GameObject.FindGameObjectWithTag("weather").transform.GetChild(0).gameObject;
}
protected override void OnRealtimeModelReplaced(windStormPowerUpModel previousModel, windStormPowerUpModel currentModel) {
print("test");
if (previousModel != null) {
previousModel.startedDidChange -= StartedDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.started = shouldStart;
}
UpdateStarted();
currentModel.startedDidChange += StartedDidChange;
}
}
private void StartedDidChange(windStormPowerUpModel model, bool value) {
UpdateStarted();
}
private void UpdateStarted() {
shouldStart= model.started;
print("get");
if(shouldStart)
{
meshRenderer.enabled = false;
coll.enabled = false;
grab.enabled=false;
particles.Stop();
StartCoroutine(windForce(windDuration));
}
else
{
wind.gameObject.SetActive(false);
}
}
public void SetStarted(bool started) {
model.started = started;
print("set");
}

}
when i run SetStarted(true), i only get "set" in the console. i tried re-adding the component and it didnt work.
6 replies
NNormal
Created by MasterOX 水 on 8/11/2024 in #🤝ask-a-question
physics question
if i have a script that applies a force to an object every frame, will it apply the force twice if 2 players are in the lobby?
12 replies
NNormal
Created by MasterOX 水 on 8/7/2024 in #🤝ask-a-question
physics objects ownership
physics objects dont move unless they are owned. is there a way to change that?
21 replies
NNormal
Created by MasterOX 水 on 8/3/2024 in #🤝ask-a-question
player teleport
dumb question but if i want to teleport a player to a specific location and have it sync to everyone, should i update the position of the xr origin (im using xr interaction toolkit) or the vr player?
5 replies
NNormal
Created by MasterOX 水 on 8/3/2024 in #🤝ask-a-question
hp update problem
ok so ive been trying to get this to work for 5 hours
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Normal.Realtime;
public class playerHealthSync : RealtimeComponent<playerHealthModel> {
public int health = 20;
public Realtime rt;
public Transform spawn1;
public Transform spawn2;
public GameObject player;

protected override void OnRealtimeModelReplaced(playerHealthModel previousModel, playerHealthModel currentModel) {
if (previousModel != null) {
previousModel.hpDidChange -= HpDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.hp = health;
}
UpdateHp();
currentModel.hpDidChange += HpDidChange;
}
}
private void HpDidChange(playerHealthModel model, int value) {
UpdateHp();
}
private void UpdateHp() {
print("updated hp");
health= model.hp;
}
public void SetHp(int hp) {
print("set hp");
model.hp = hp;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Normal.Realtime;
public class playerHealthSync : RealtimeComponent<playerHealthModel> {
public int health = 20;
public Realtime rt;
public Transform spawn1;
public Transform spawn2;
public GameObject player;

protected override void OnRealtimeModelReplaced(playerHealthModel previousModel, playerHealthModel currentModel) {
if (previousModel != null) {
previousModel.hpDidChange -= HpDidChange;
}
if (currentModel != null) {
if (currentModel.isFreshModel){
currentModel.hp = health;
}
UpdateHp();
currentModel.hpDidChange += HpDidChange;
}
}
private void HpDidChange(playerHealthModel model, int value) {
UpdateHp();
}
private void UpdateHp() {
print("updated hp");
health= model.hp;
}
public void SetHp(int hp) {
print("set hp");
model.hp = hp;
}
}
this is the script that syncs the health, evey player has it attatched to them and this is the thing that updates the health
if(canHit && coll.tag=="MPPlayer")
{
coll.gameObject.transform.GetChild(0).GetComponent<RealtimeView>().ClearOwnership();
coll.gameObject.transform.GetChild(0).GetComponent<playerHealthSync>().SetHp(coll.gameObject.transform.GetChild(0).GetComponent<playerHealthSync>().health-damagePlayer);
}
if(canHit && coll.tag=="MPPlayer")
{
coll.gameObject.transform.GetChild(0).GetComponent<RealtimeView>().ClearOwnership();
coll.gameObject.transform.GetChild(0).GetComponent<playerHealthSync>().SetHp(coll.gameObject.transform.GetChild(0).GetComponent<playerHealthSync>().health-damagePlayer);
}
what happens is: if i attack the other player with the sword, its health updates on my screen but not on their screen if i attack myself with the sword, my hp updates on both screens, as it should. whats the problem
25 replies
NNormal
Created by MasterOX 水 on 8/3/2024 in #🤝ask-a-question
prevent ownership of child
the docs say this: "However, when a model is owned by a client, the server only lets the owning client make changes to it or to any of its child models." i need the parent to be owned but allow anyone to make changes to one of its children. how can i do that?
5 replies
NNormal
Created by MasterOX 水 on 8/3/2024 in #🤝ask-a-question
box collider sync
will the size and center of a box collider sync if the gameobject that has the box collider attached to it also has realtime transform
12 replies
NNormal
Created by MasterOX 水 on 7/16/2024 in #🤝ask-a-question
syncing animations
whats the best way to sync an animation, my setup is: an AI spawner spawns multiple AIs that move to the closest block and start destroying it, and im not quite sure on the best way to sync the destroying animation. also, when the ai is spawned, i made it so if you didnt create the room, the ai script gets disabled (this way, only the server owner manages the ai)
7 replies
NNormal
Created by MasterOX 水 on 7/15/2024 in #🤝ask-a-question
how to sync multiple values in a model
how do i have one model script that syncs multiple values
5 replies
NNormal
Created by MasterOX 水 on 7/4/2024 in #🤝ask-a-question
how to handle code server side
how do i run a timer for example on the server and get a signal sent to all the clients when that timer reaches 0
9 replies
NNormal
Created by MasterOX 水 on 6/13/2024 in #🤝ask-a-question
error when syncing custom int
Failed to set model on component (1:score2 (score2)).
7 replies
NNormal
Created by MasterOX 水 on 6/8/2024 in #🤝ask-a-question
realtime.destroy problem
Realtime: Could not find RealtimeViewModel for RealtimeView in the datastore. Unable to destroy RealtimeView. UnityEngine.Debug:LogError (object)
5 replies
NNormal
Created by MasterOX 水 on 6/7/2024 in #🤝ask-a-question
normcore pricing question
is the 120GB of data per month or forever (for the free plan)
7 replies
NNormal
Created by MasterOX 水 on 6/7/2024 in #🤝ask-a-question
show lobbies
how would i make a system that shows all of the current active games?
6 replies
NNormal
Created by MasterOX 水 on 6/7/2024 in #🤝ask-a-question
realtime.destroy
how do you use realtime.destroy
4 replies
NNormal
Created by MasterOX 水 on 6/7/2024 in #🤝ask-a-question
instantiate at specific coords
how can i instantiate something with Realtime.Instantiate at a specific position
9 replies
NNormal
Created by MasterOX 水 on 6/4/2024 in #🤝ask-a-question
request ownership
i forgot how to request ownership can u please tell me
5 replies
NNormal
Created by MasterOX 水 on 5/14/2024 in #🤝ask-a-question
webgl
do i have to do something to make webgl work or will it work as it is?
10 replies