I don’t know if hiding objects or opacity will help us reduce latency so I think deleting and saving information like total colors, sizes in the list and recreating copies of them along with the data of you’re in an area that the camera can see, and removing things the camera can’t see can make the game less laggy.
First idea: see anything in radius
Seconds idea: see anything in raycast
Third idea: 1+2
use idea 1 and 2
Code suggestions:
form @techleapnz
/////////////////////////////////////////////////////////////////////////////
second idea:
//Casts a ray from the camera position towards the camera direction every frame
Time.scheduleRepeating(() => {
let rayCastHit = RayCast.cast(Camera.transform.position,Camera.transform.forward)
if (rayCastHit) {
Debug.log(Ray hit item: ${rayCastHit.item.name}
)
} else {
Debug.log(“Ray hit no item.”)
}
})
Idea 1:(if change opacity help reduce latency)
var wall = Scene.getItem(“RHe5hvwd”) as Cuboid
Time.scheduleRepeating(() => {
let rayCastHit = RayCast.cast(Camera.transform.position, Camera.transform.forward)
if (rayCastHit) {
wall.opacity = 1
} else {
wall.opacity = 0
}
})
Idea 2:(if change opacity help reduce latency)
var wall = Scene.getItem(“RHe5hvwd”) as Cuboid
var cam = Scene.getItem(“HW96sXlD”) as CameraItem
Time.scheduleRepeating(() => {
let distance = cam.center.dist(wall.center);
if (distance > 10) {
wall.opacity = 0
}else{
wall.opacity = 1
}
}, 0.01)