**Trying to make a shield that slows downs bullets when bulletes enter**

Bullet tag: Bullet and
shield tag: BulletTimeShield

hey i have tryed so many things and i really need help!

like i said at the top im trying to make a shield that slows the bulletes as they are going in and speeds up to normal speed when they exit

i have tried rigidbody drag and Oncollisionenter and exit but thats not working

i really hope that some one can help me

thanks for reading and your time

make a gameObject i.eBulletSpeedHandler that handle all bullet speed.
make a static float speed variable here so that every bullet can get speed from here. and make sure u are using speed like this

transfrom.translate(BulletSpeedHandler.speed*vector2.whateverDirection)

now in the shield you need to reduce/increase the value of speed simply
,sdsf

OnCollisionEnter, access via GetComponent the rigidbody of the object. Store the current velocity value. Reduce it by percentage or fraction and restore it OnCollisionExit

This may not work as expected due to discrepencies in the Collision Detection of fast moving objects.

However, as you imply the object should move through, you will probably need to use OnTrigger functions instead.


Edit : Ok, on large objects it seems that this approach only works while planes are intersecting. However, this following method will work but may be a little intensive. Its a little rough and has drawbacks specifically with multiple objects, but its for the illustration of a working method.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SlowObject : MonoBehaviour {

	Vector3 tempTriggerVelocity;
	Rigidbody otherRB;
	float scaler = 0.1f;
	
	void OnTriggerEnter(Collider other)
	{
		otherRB = other.gameObject.GetComponent<Rigidbody>();
		tempTriggerVelocity = otherRB.velocity;
	}
	
	void OnTriggerStay(Collider other)
	{
		otherRB.velocity = tempTriggerVelocity * scaler;
	}
	
	void OnTriggerExit(Collider other)
	{
		other.gameObject.GetComponent<Rigidbody>().velocity = tempTriggerVelocity;
	}
}