创建平面和小球,给力或给速度让其弹起
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class c4 : MonoBehaviour
{
// 刚体组件
private Rigidbody body;
void Start()
{
// 加载刚体组件
body = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
}
// 开始碰撞
private void OnCollisionEnter(Collision collision)
{
// 给物体一个力
// body.AddForce(Vector3.up * 300);
// 给物体一个速度
body.velocity = Vector3.up * 7;
// 和给力的效果一样
// body.velocity += Vector3.up * 7;
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- sarr.cn 版权所有 赣ICP备2024042794号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务