New answers tagged

1

You actually have 2 ways of doing the frustum check: 1) Every scene component (or most fo them) has a property WasRecentyRendered() -- so if it was recently rendered - they are 99% in the camera frustum. 2) You can manually check the frustum with something like described here: UE4_AnswersHub_Link To make it all performant you can trigger some object-...


0

Just add this script on the object you want to get destroyed as soon as it leaves view: using UnityEngine; public class DestroyWhenInvisible: MonoBehaviour { void OnBecameInvisible() { Destroy(this.gameObject); } } However, in many cases this will go a bit too far. There might be situations where an object becomes invisible for another ...


1

There are plenty of tutorials about infinite procedural generation. Usually they all have the behaviour of cleaning up objects that are left behind the player, and creating objects in front of the player when required. It can be done in multiple ways. If you just want to know if the object is off screen or not, this question may help: Identify whether ...


-1

What you need to do is to move the player "to" the collision when one is detected using raycasting before actually moving the player. You should raycast from the leading sides of the player (if velocity.x > 0, raycast from the right edge of the player, if velocity.y < 0, raycast from the bottom, etc.) multiple times along those edges. If a collision ...


Top 50 recent answers are included