当前位置: 首页 > article >正文

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

(一)铰链组件
1.创建一个立方体和角色胶囊
在这里插入图片描述
2.给角色胶囊挂在控制脚本和刚体

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 弹簧组件


http://www.kler.cn/a/542718.html

相关文章:

  • 星动纪元ERA-42:端到端原生机器人大模型的里程碑式突破
  • 深度学习入门--python入门1
  • React 什么时候会触发重新渲染?
  • Unity3D实现显示模型线框(shader)
  • deepseek和chatgpt对比
  • 交叉编译工具链下载和使用
  • 在 Navicat 17 中扩展 PostgreSQL 数据类型 - 枚举类型
  • 信息安全之网络安全
  • CSS 表单 实现响应式布局
  • DeepSeek影响网络安全行业?
  • UWB功耗大数据插桩调研
  • 深度学习的图像生成
  • redo和binlog区别
  • SQLite 约束
  • Nat Python:用于自然语言处理的Python库
  • 【网络安全】无线安全协议的演变
  • VeryReport和FastReport两款报表软件深度分析对比
  • DeepSeek做赛车游戏
  • C++智能指针的使用
  • C语言————快速幂
  • java项目之直销模式下家具工厂自建网站源码(ssm+mysql)
  • npm 常用命令大全
  • 数据总线/一致性维度/总线矩阵
  • Mac(m1)本地部署deepseek-R1模型
  • Ubuntu学习---跟着绍发学成后自学教程(附带优秀链接)
  • vue3:template中v-for循环遍历这个centrerTopdata,我希望自循环前面三个就可以了怎么写?