Inuninu
Inuninu3w ago

Help Syncing Mesh sliced position. Can anyone help

I am having problem syncing the mesh sliced position. The mesh's transform and rotation is syncing well but th e sliced position is not syncing. can anyone help?
5 Replies
kapa.ai
kapa.ai3w ago
Hi @Inuninu. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I apologize, but the provided knowledge sources do not contain specific information about syncing mesh sliced positions in NormalVR. The documents mainly cover general concepts of RealtimeTransform, RealtimeComponents, and networked physics, but don't address mesh slicing synchronization. However, I can offer some general advice based on the available information about NormalVR: 1. Ensure you're using a custom RealtimeComponent to synchronize your mesh data. As mentioned in the Synchronizing Custom Data (https://normcore.io/documentation/realtime/synchronizing-custom-data) guide, you'll need to create a custom component and model to sync specific data like mesh slicing. 2. Make sure you have proper ownership of the object you're trying to modify. As explained in the RealtimeTransform (https://normcore.io/documentation/realtime/realtimetransform#ownership) documentation, you need to be the owner of an object to modify its state. 3. If you're using a Rigidbody, be aware of the differences between Transform mode and Rigidbody mode, as outlined in the Transform mode vs. Rigidbody mode (https://normcore.io/documentation/realtime/realtimetransform#transform-mode-vs-rigidbody-mode) section. 4. Check if your custom RealtimeComponent is properly added to the RealtimeView's list of components. The FAQ (https://normcore.io/documentation/realtime/synchronizing-custom-data#faq) mentions this as a common issue for components not syncing. For more specific help with syncing mesh sliced positions, I recommend reaching out to the Normcore community on their Discord channel, as they might have more experience with this particular use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@354846683693187082> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit3w ago
try setting the slice position relative to the object being sliced create a custom sync model with a local position and rotation on it for the slice @Normcore Assistant write a custom model that sets a local position and rotation to slice an object
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- To create a custom model for setting a local position and rotation to slice an object in NormalVR, we can use the RealtimeModel approach. Here's an example of how you might structure this model based on the information provided in the knowledge sources:
using UnityEngine;
using Normal.Realtime.Serialization;

[RealtimeModel]
public partial class SlicerModel
{
[RealtimeProperty(1, true)]
private Vector3 _slicePosition;

[RealtimeProperty(2, true)]
private Quaternion _sliceRotation;
}
using UnityEngine;
using Normal.Realtime.Serialization;

[RealtimeModel]
public partial class SlicerModel
{
[RealtimeProperty(1, true)]
private Vector3 _slicePosition;

[RealtimeProperty(2, true)]
private Quaternion _sliceRotation;
}
This model defines two properties: _slicePosition for the local position of the slice, and _sliceRotation for the rotation of the slice. Both are marked as RealtimeProperties, which means they will be synchronized across the network. After creating this model, you'll need to compile it using the "Compile Model" button in the Unity inspector, as mentioned in the Creating a Multiplayer Drawing App guide (https://normcore.io/documentation/guides/creating-a-multiplayer-drawing-app#models-part-2). To use this model in a RealtimeComponent, you would create a script like this:
using UnityEngine;
using Normal.Realtime;

public class Slicer : RealtimeComponent<SlicerModel>
{
public void SetSliceTransform(Vector3 position, Quaternion rotation)
{
// Update the model
model.slicePosition = position;
model.sliceRotation = rotation;
}

protected override void OnRealtimeModelReplaced(SlicerModel previousModel, SlicerModel currentModel)
{
if (previousModel != null)
{
// Unregister from events
}

if (currentModel != null)
{
// Register for events if needed
// Apply the initial state
ApplySliceTransform();
}
}
private void ApplySliceTransform()
{
// Apply the slice position and rotation to your slicing logic here
// For example:
// slicePlane.localPosition = model.slicePosition;
// slicePlane.localRotation = model.sliceRotation;
}
}
using UnityEngine;
using Normal.Realtime;

public class Slicer : RealtimeComponent<SlicerModel>
{
public void SetSliceTransform(Vector3 position, Quaternion rotation)
{
// Update the model
model.slicePosition = position;
model.sliceRotation = rotation;
}

protected override void OnRealtimeModelReplaced(SlicerModel previousModel, SlicerModel currentModel)
{
if (previousModel != null)
{
// Unregister from events
}

if (currentModel != null)
{
// Register for events if needed
// Apply the initial state
ApplySliceTransform();
}
}
private void ApplySliceTransform()
{
// Apply the slice position and rotation to your slicing logic here
// For example:
// slicePlane.localPosition = model.slicePosition;
// slicePlane.localRotation = model.sliceRotation;
}
}
Remember to add this Slicer component to your GameObject and ensure it's included in the RealtimeView component list. Note that this example provides a basic structure for synchronizing slice position and rotation. You'll need to implement the actual slicing logic yourself, as the provided knowledge sources don't contain information about mesh slicing specifically. For more detailed information on creating custom RealtimeComponents and Models, refer to the Synchronizing custom data (https://normcore.io/documentation/realtime/synchronizing-custom-data) guide in the Normcore documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@162940911964258305> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?