Untiy3d 铰链、弹簧,特殊的物理关节

(一)铰链组件

1.创建一个立方体和角色胶囊

2.给角色胶囊挂在控制脚本和刚体

csharp 复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class plyer : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        // 水平轴
        float horizontal = Input.GetAxis("Horizontal");
        // 垂直轴
        float vertical = Input.GetAxis("Vertical");
        // 向量
        Vector3 dir = new Vector3(horizontal, 0, vertical);
        // 朝向范方向移动
        transform.Translate(dir * 2 * Time.deltaTime);



    }
}

4.给立方体挂载刚体Rigidbody和铰链Hinge Joint组件

效果

untiy 3d 弹簧组件

(二)弹簧组件

1.创建2个立方体

2.给2个立方体挂在刚体组件

3.给上面的立方体挂在弹簧组件并给上面的立方体设置是运动学防止掉下来


运行效果

untiy 3d 弹簧组件

相关推荐
2501_9159090610 小时前
深入解析Mock.js:功能、应用及实战案例,提升前端开发效率
android·ios·小程序·https·uni-app·iphone·webview
流星白龙12 小时前
【MySQL高阶】21.撤销表空间,撤销日志
android·mysql·adb
code_pgf12 小时前
PointPillars 3D 目标检测详解
人工智能·目标检测·3d
我命由我1234513 小时前
Android 开发,FragmentPagerAdapter 的 isViewFromObject 方法问题
android·java-ee·kotlin·android studio·android jetpack·android-studio·android runtime
weiggle13 小时前
第五篇:Modifier 解析——链式调用的艺术
android
awu的Android笔记13 小时前
Android 弱网模拟:别只会用均匀分布——三种延迟模型和两种丢包模型的原理与实现
android·tcp/ip
jingling55513 小时前
从零到一:用 Aholo Viewer 在浏览器里渲染 3D 高斯泼溅小熊
linux·前端·ubuntu·3d
weixin_4516298413 小时前
【leaflet中实现区块hover突出的伪3d效果】
3d
深圳市机智人激光雷达13 小时前
时空解算与图优化:激光雷达 3D 建图的技术原理与实现流程
人工智能·3d·机器人·自动化·自动驾驶·激光雷达
海伯森技术13 小时前
海伯森3D线光谱共焦精密测量技术及产业化应用
大数据·人工智能·3d