物理材质Physic Material;

当碰撞器发生碰撞的时候,具有该材质的游戏物体就会具有该材质的属性;

Step1:在Project窗口下新建Physic Material(命名为mat),并更改其弹力参数为1

Step2:在游戏物体的碰撞器属性的Material不留空,设为Physic Material即可

Step3: Bounciness(弹力)调成1,最大只能是1

Step4:然后1还不够大如何办呢?

就是把BounceCombine设为 max, 其他选项由大到小,max是最大力,也没有其他方法了

Step4-2:假如还不够,只能自己写一个发射器了

有在项目用,但贴出代码未必完整,请自行判断使用


// Slingshot : Description : Mange slingshot mechanics.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Sling(投石器)会反弹球和得分,反弹公式和 【Force parameters】有关;
/// rigidBody 加力量 = 朝向 * Sling力 * 最大加速度
/// </summary>
public class Slingshot : MonoBehaviour {[Header ("Infos to missions")]public int index;                           // choose a number. Used to create script mission.public GameObject[] Parent_Manager;                   // Connect on the inspector the missions that use this objectpublic string functionToCall = "Counter";           // Call a function when OnCollisionEnter -> true;[Header ("Force parameters")] public float Slingshot_force = 10;                 // change the slingshot force added to a ballpublic float ForceMinimum = 1;                // Minimum contact velocity between ball and slingshot to apply forcepublic float relativeVelocityMax = 1;                 // The maximum force apply to the ball[Header ("Sound fx")]   public AudioClip Sfx_Hit;                   // Sound when ball hit the slingshot        private AudioSource  sound_;                    // Audio Component[Header ("Points when the slingshot is hit")]public int Points = 1000;                 // Points you win when the object is hitting private GameObject obj_Game_Manager;private Manager_Game gameManager;[Header ("Connect a led")]public GameObject obj_Led;                    // Usefull if you want a led blinked when the slingshot is hittingprivate ChangeSpriteRenderer Led_Renderer;[Header ("Toy connected to the Slingshot")    ]               // Connect a GameObject or paticule system with the script Toys.js attachedpublic GameObject obj_Toy;                   // Usefull if you want a led blinked when the slingshot is hittingprivate Toys toy;public int animNumber = 0;void Start(){                                                                 //  --> Initobj_Game_Manager = GameObject.Find("Manager_Game");                               // Find the gameObject Manager_Gameif(obj_Game_Manager!=null)gameManager = obj_Game_Manager.GetComponent<Manager_Game>();                   // Access Manager_Game from obj_Game_Managersound_ = GetComponent<AudioSource>();                                            // Access AudioSource Componentif(obj_Led)Led_Renderer = obj_Led.GetComponent<ChangeSpriteRenderer>();       // Access led component if neededif(obj_Toy)toy = obj_Toy.GetComponent<Toys>();                                  // Access led component if needed}void OnCollisionEnter(Collision collision) {                                  // --> OnCollisionEnter with the ballRigidbody rb = collision.gameObject.GetComponent<Rigidbody>();if (rb != null && collision.relativeVelocity.magnitude > ForceMinimum){if(collision.relativeVelocity.magnitude < relativeVelocityMax){//Debug.Log("Yipo");float t = collision.relativeVelocity.magnitude;rb.velocity = new Vector3(rb.velocity.x*.5f,rb.velocity.y*.5f,rb.velocity.z*.5f);          // reduce the velocity at the impact. Better feeling with the slingshotrb.AddForce(transform.forward*Slingshot_force*t,ForceMode.VelocityChange);           // add force}elserb.AddForce(transform.forward*Slingshot_force*relativeVelocityMax,ForceMode.VelocityChange);if(Sfx_Hit)sound_.PlayOneShot(Sfx_Hit);                                        // Play a sound if neededfor(var j = 0;j<Parent_Manager.Length;j++){Parent_Manager[j].SendMessage(functionToCall,index);                  // Call Parents Mission script}if(gameManager)gameManager.F_Mode_BONUS_Counter();                                           // add one to the BONUS_Counterif(gameManager)gameManager.Add_Score(Points);                                                // add pointsif(obj_Led)Led_Renderer.Led_On_With_Timer(.2f);                                // blinkingif(obj_Toy)toy.PlayAnimationNumber(animNumber);                              // play animation}}}

Unity物理系统-物理材质-Collider碰撞体的弹力不够大如何处理相关推荐

  1. Unity3D入门(八):物理组件之刚体与碰撞体

    Unity3D入门(八):物理组件之刚体与碰撞体 准备工作 物理组件之刚体 刚体组件简介 使用刚体移动物体 遇到的问题 物理组件之碰撞体 碰撞体简介 碰撞体种类 Box Collider Sphere ...

  2. Unity物体系统rigidbody和collider

    刚体 rigidbody rigid僵化的.坚硬的 rigidbody 刚体 通常把在物理作用下,物体的形状和大小保持不变,而且内部各部分相对位置保持恒定(没有形变)的理想物理模型称为刚体 可以为游戏 ...

  3. Unity(贴图、材质、预设体)

    我们创建一个地形(Terrain),在Inspector栏下就有个Terrain的组件,其功能是可以编辑地形, 首先橙色箭头所指的按钮,其功能可以设置地形的限高,地形的大小等待. 蓝色箭头所指的按钮, ...

  4. Unity自动化碰撞体生成方法-Normal Collider 和 碰撞体代理

    如何在Unity中对角色快速创建碰撞体(Normal Collider)和碰撞体代理(Fake Collider) 前言 快速给Humanoid人形角色添加碰撞体,使用Unity 的Collider系 ...

  5. Unity 3D 碰撞体(Collider)|| Unity 3D 触发器(Trigger)

    在游戏制作过程中,游戏对象要根据游戏的需要进行物理属性的交互. 因此,Unity 3D 的物理组件为游戏开发者提供了碰撞体组件.碰撞体是物理组件的一类,它与刚体一起促使碰撞发生. 碰撞体是简单形状,如 ...

  6. unity 根据模型生成碰撞体_Unity之碰撞体组件

    3D物理组件中碰撞体组件添加与设置 碰撞体是物理组件中的一类,3D物理组件和2D物理组件有独特的碰撞体组件,它要与刚体一起添加到游戏对象上才能触发碰撞.如果两个刚体相互撞在一起,除非两个对象有碰撞体时 ...

  7. Unity 之刚体,碰撞体,触碰器

    Unity中文官方文档https://docs.unity.cn/cn/current/Manual/class-Rigidbody2D.html Rigidbody 刚体 是赋予物体力的的作用效果的 ...

  8. Cocos 物理系统

    官方文档链接:https://docs.cocos.com/creator/2.3/manual/zh/physics/physics/physics-manager.html Cocos 物理系统 ...

  9. Unity 碰撞体 composite

    unity中盒型碰撞体与多边形碰撞体有used by composite这一选项,如果勾选这一选项代表该碰撞体可以被之后添加的composite 复合碰撞体使用,复合碰撞体会将该碰撞体的box与pol ...

最新文章

  1. 如何将网站升级为HTTPS协议?
  2. PHP导出MySQL数据字典
  3. 人脸检测中,如何构建输入图像金字塔
  4. ActionScript for Multiplayer Games and Virtual Worlds 下载。
  5. 转正老板让你谈谈你的看法_让我们谈谈逻辑回归
  6. c ++查找字符串_C ++朋友功能| 查找输出程序| 套装2
  7. 【Python】Matplotlib使用Cursor实现UI定位
  8. HTML多选框滚动条,08:HTMLayout 自定义滚动条样式
  9. 开火锅店的明星们,什么时候才能不道歉?
  10. 傅里叶变换及其应用 pdf_应用傅里叶-小波检测方式的并联型有源电力滤波器,电能质量高...
  11. 百度面试题:Median of Two Sorted Arrays(java实现)
  12. 如何应对美国对开源项目的出口管制?这是Linux基金会的建议
  13. python提取图片中的文字并生成word文档
  14. 广义表(Generalized Lists)
  15. 三菱FX3U——ST编程FOR循环
  16. Java对象与json转换
  17. linux系统硬盘设置密码,linux下硬盘加密
  18. 企业申报能力评估CS1级\CS2级该如何选择?
  19. 音频采样及编解码——LPCM 、ADPCM、G711、G726
  20. Java 作业题 输入年份求生肖

热门文章

  1. 使用esp8266作为I2C传感器的主机
  2. 数字电路基础与Quartus-ll入门
  3. OpenCV仿射变换--平移
  4. 增大/减少Mp3文件的默认音量—令其统一音量
  5. linux怎么远程登录是图形界面,教你远程登录ubuntu图形界面
  6. 重温CS1.5(解决卡通模版人物死后不倒的问题,并附模型下载)
  7. matlab实现sobel边缘检测图像,基于Sobel算子图像边缘检测的MATLAB实现
  8. 局域网即时通信软件都有哪些?要如何选择?
  9. SRPG游戏开发(七)第三章 绘制地图 - 四 初步完善地图编辑器(Map Graph)
  10. 软件界面原型设计工具 Web Axure RP