首页 > 其他分享 >13-Generating_ Contacts

13-Generating_ Contacts

时间:2024-03-13 15:15:24浏览次数:31  
标签:13 objects point contacts Generating edge Contacts collision contact

Many collision detection systems perform this check for each pair and return a single point of maximum interpenetration if the objects are in contact. That is not what we need. We need contact generation.
The bulk of this chapter looks at generating the contacts between geometric primitives that are useful as stand-in collision geometry.

COLLISION GEOMETRY

In many games, it is simplified into a chunky geometry created just for the physics.This chunky geometry consists of certain geometric primitives namely, spheres, boxes, planes, and capsules.It is important to remember that the primitives your game needs will depend to
some extent on the game.

PRIMITIVE ASSEMBLIES


The vast majority of objects can't easily be approximated by a single primitive shape. Some developers don't even try: they use convex meshes to approximate all objects. Another approach is to use assemblies of primitive objects as collision geometry.

Generating Collision Geometry

  • The easiest method is to ask designers to create the collision geometry manually.
  • created tools for generating simplified convex meshes to act as collision geometry.

Contact Generation

It is important to make a distinction between collision detection and contact generation.Collision detection determines whether two objects are touching or interpenetrated, and normally provides data on the largest interpenetration point.Contact generation produces the set of points on each object that are in contact(or penetrating).

The difference is crucial. In figure, one box is lying across another: in the left part of the figure the result of a typical collision detection system is shown: the box is slightly(microscopically) twisted, so one edge generates the contact. In the right part of the figure the correct contact patch is generated. To make things easier we would like to deal only with point contacts.

we will be looking for point–face contacts and edge–edge contacts first.

Contact Data

  • The collision point This is the point of contact between the objects. In practice objects will be interpenetrating somewhat, and there may be any number of possible points.
  • The collision normal. This is the direction in which an impact impulse will be felt between the two objects.
  • The penetration depth This is the amount that the two objects are interpenetrating.
class Contact
{
    /**
    * Holds the position of the contact in world coordinates.
    */
    Vector3 contactPoint;
    /**
    * Holds the direction of the contact in world coordinates.
    */
    Vector3 contactNormal;
    /**
    * Holds the depth of penetration at the contact point. If both
    * bodies are specified then the contact point should be midway
    * between the inter-penetrating points.
    */
    real penetration;
};

Primitive Collision Algorithms

Each of the collision algorithms in this chapter checks for contact and generates contact data structures for different combinations of primitives.

    /**
    * A helper structure that contains information for the detector to use
    * in building its contact data.
    */
    struct CollisionData
    {
        /** Holds the contact array to write into. */
        Contact *contacts;
        /** Holds the maximum number of contacts the array can take. */
        unsigned contactsLeft;
    };
  • COLLIDING TWO SPHERE

  • COLLIDING A SPHERE AND A BOX

  • COLLIDING TWO BOXES

There are six possible types of contact between two boxes, as shown in figure. We're trying to avoid face–face and edge–face contacts because they are not stable.A single contact point between two planes allows the planes to rotate; it is unlikely that the contact normal will be generated so that it passes through both centers of gravity.

We can always replace a face–face contact with up to four point–face or edge–edge contacts. Similarly we can replace face–edge contacts with up to two point–face or edge–edge contacts.

标签:13,objects,point,contacts,Generating,edge,Contacts,collision,contact
From: https://www.cnblogs.com/ultramanX/p/18070670

相关文章

  • 2024-03-13:用go语言,给定一个二叉搜索树, 找到该树中两个指定节点的最近公共祖先。 输
    2024-03-13:用go语言,给定一个二叉搜索树,找到该树中两个指定节点的最近公共祖先。输入:root=[6,2,8,0,4,7,9,null,null,3,5],p=2,q=8。输出:6。答案2024-03-13:来自左程云。灵捷3.5大体步骤如下:1.首先,我们需要遍历树来找到这两个节点。从根节点开始,若两个节点都比......
  • 4.13 ACM-ICPC算法 字符串之后缀自动机
    4.13ACM-ICPC算法:字符串之后缀自动机在竞赛编程,尤其是ACM-ICPC竞赛中,字符串算法占据了极其重要的位置。其中,后缀自动机(SuffixAutomaton,简称SAM)以其强大的功能和高效的性能,成为了解决字符串问题的利器。本文旨在介绍后缀自动机的基本概念、构建方法以及在算法竞赛中的应......
  • abc134F题解
    abc134F题意:定义长度为\(n\)的排列的怪异值为\(\sum_{i=1}^{n}\midp_i-i\mid\),问长度为\(n\),怪异值为\(k\)的排列数。思路:非常妙的dp题。\(\midp_i-i\mid\)可以看成上下两层数,将上层中的\(i\)和下层中的\(j\)匹配,怪异值增加\(i\),\(j\)中较大值减较小值。整体思路为从小到......
  • Offer必备算法13_路径dp_六道力扣题详解(由易到难)
    目录①力扣62.不同路径解析代码②力扣63.不同路径II解析代码③力扣LCR166.珠宝的最高价值解析代码④力扣931.下降路径最小和解析代码⑤力扣64.最小路径和解析代码⑥力扣174.地下城游戏解析代码本篇完。①力扣62.不同路径62.不同路径难度中等一个......
  • 算法入门书籍(二)--2024.03.13
    小学C++编程入门书籍及相关资料介绍(二)算法篇小学C++编程入门书籍及相关资料介绍(二)算法篇_c++教材-CSDN博客 算法入门书籍--2022.04.04算法入门书籍--2022.04.04-CSDN博客1、聪明人的游戏信息学探秘.提高篇-2017年06月2、啊哈!算法3、哇,编程!——跟小明一起学......
  • 【3月13日-云服务器推荐】京东云新上1年福利机型 阿里云活动页大改 选购指南 最新价格
     本文纯原创,侵权必究 《最新对比表》已更新在文章头部—腾讯云文档,文章具有时效性,请以腾讯文档为准!【腾讯文档实时更新】云服务器1分钟教会你如何选择教程https://docs.qq.com/document/DV0RCS0lGeHdMTFFV?tab=000003视频解读最新活动:【云服务器推荐】价格对比!阿里云......
  • 3月13每日打卡
    净现值计算的程序JAVAimportjava.util.Scanner;publicclassNPVCalculator{publicstaticvoidmain(String[]args){Scannerinput=newScanner(System.in);System.out.print("请输入投资项目的年限:");intyears=input.nextInt();......
  • 今日早报 每日精选15条新闻简报 每天一分钟 知晓天下事 3月13日,星期三
    每天一分钟,知晓天下事!2024年3月13日星期三农历二月初四1、四部门:中小学每天安排30分钟大课间体育活动,缓解视力疲劳。2、我国视障人士首次使用无障碍格式文件完成结婚登记。3、数据显示:城乡居民医保的参保人数从2019年开始逐渐下降。4、福建:节假日期间,鼓励......
  • 13-网络编程
    在网络通信协议下,不同计算机上运行的程序进行数据的传输;封装在java.net包下网络编程三要素:IP:设备在网络中的地址,是唯一的标识端口号:应用程序在设备中的唯一标识协议:数据在网络中传输的规则TCP、UDP、http、https、ftpIP:InternetProtocol互联网协议地址,常见的IP分为IPV4......
  • 3月13日 新榜情报
    3月13日新榜情报1.“抖音商城38好物节”日均支付GMV同比增长33%2.抖音电商推出“抖音商城服饰焕新周”专项促销活动3.快手电商“兴农计划”首站直播培训落地海南三亚4.快手:2023年向16.1万名用户发送网暴提醒或不友善言论提醒5.小红书上线商家举报中心6.诺贝尔文学奖得主古......