Normal view

There are new articles available, click to refresh the page.
Before yesterdayUnity Forum

Custom Spotlight Calculation not working

Does anyone know how the inner spotlight angle for a spotlight in Unity's built-in render pipeline is calculated (since I can't set them manually)?

I fake spotlights with a custom shader based on billboards. The shader calculates the lighting like this:

Code (csharp):
  1. float3 IncomingLight(float3 surfaceNormal, Light light)
  2. {
  3.    return saturate(dot(surfaceNormal, light.direction) * light.attenuation) * light.color;
  4. }
  5.  
  6. float GeneralAttenuation(float normalizedDistance)
  7. {
  8.     // return saturate(1.0 /...
Custom Spotlight Calculation not working

Weird Collision Contact Points

Hi everyone,

I was experimenting with Unity's Physics.ContactModifyEvent and I noticed that every now and then contact pairs with contact points that are outside my helicopter's rotor's BoxCollider get generated (the magenta colored dots).



Can anyone explain to me why that happens?

Thank you in advance for your help!

Non-physics object replacement based on proximity to physics object

Hello everyone,

I'm working on a Unity 3D project where I have various objects moving along tracks in the scene. I want to implement a feature where, when the player's physics-based vehicle is about to collide with one of these objects, the respective object is replaced with a variant containing Rigidbody and Collider components to realistically react to the collision. However, I'd like to achieve this replacement only shortly before the actual collision occurs, without using a trigger...

Non-physics object replacement based on proximity to physics object
❌
❌