Hello I made a python revolver that kills in first glance and I want to make that python seem more powerful. So when I shoot people, I desire to make people's dead body go further as a reflection of projectile. I can add rigidbody.velocity() function to player corpses after shot but it has delayed respond.
Do you guys have any idea for quickest respond?
using Newtonsoft.Json;
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
using JetBrains.Annotations;
using System;
using Facepunch;
namespace Oxide.Plugins
[Info("StrongPyhton", "Xoetoart", 0.1)]
[Description("Strong Phyton")]
public class StrongPython : RustPlugin
{
void OnEntitySpawned(BaseNetworkable entity)
{
//I didnt specified the gun. It works when player die with any weapon.
if (entity == null) return;
if(entity is PlayerCorpse)
{
entity.gameObject.AddComponent<DyingAnimation>();
}
}
}
class DyingAnimation:MonoBehaviour
{
BaseNetworkable entity;
Configuration configuration;
void Awake()
{
entity= GetComponent<BaseNetworkable>();
DoForce();
}
void DoForce()
{
Rigidbody rb = entity.GetComponent<Rigidbody>();
ApplyForce(rb);
}
void ApplyForce(Rigidbody rigidbody)
{
rigidbody.velocity= new Vector3(0,5,15);
//added random vector to test
}
}
How can I make players body fly out when they're shot?Solved
Locked automatically