Support for Collision.hitPosition Leveraging Sybren's Collsion callback physics code #44051

Closed
opened 2015-03-20 01:28:08 +01:00 by Jacob Merrill · 16 comments

Proposal - Add Collision.hitPosition

Abstract -
Currently the ray sensor has

Ray.hitPosition

We have the new contact point callbacks, and the points are visible in the physics view mode in the game.

if this code could be leveraged to add collision.hitPosition

this would be easier for most to get the hang of, then a callback, as well as match the existing API.

Ps. While in this area, if it would also be possible to investigate collision.hitImpulse
to list the force of impact as a vector using the collision sensor?

with the two systems you could localize damage to a actor, using python.

Car hit bumper with collision.hitImpulse.magnitude

also some things are damaged when forces are not in line with a axis.

Proposal - Add Collision.hitPosition Abstract - Currently the ray sensor has Ray.hitPosition We have the new contact point callbacks, and the points are visible in the physics view mode in the game. if this code could be leveraged to add collision.hitPosition this would be easier for most to get the hang of, then a callback, as well as match the existing API. Ps. While in this area, if it would also be possible to investigate collision.hitImpulse to list the force of impact as a vector using the collision sensor? with the two systems you could localize damage to a actor, using python. Car hit bumper with collision.hitImpulse.magnitude also some things are damaged when forces are not in line with a axis.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Sybren A. Stüvel was assigned by Jacob Merrill 2015-03-20 01:28:08 +01:00
Author

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Author

Side note, could this also add .hitPosition to Near and radar sensors since they use collision anyway?

Side note, could this also add .hitPosition to Near and radar sensors since they use collision anyway?

Added subscriber: @Sergey

Added subscriber: @Sergey

Added subscribers: @Moguri, @hg1, @brita, @dfelinto

Added subscribers: @Moguri, @hg1, @brita, @dfelinto

Added subscriber: @AngusHollands-4

Added subscriber: @AngusHollands-4

I'm not sure if we should support feature request without any reference or acknowledgement of the code base for fear of simply overloading ourselves with everyone's personal requests. Any ideas?

I'm not sure if we should support feature request without any reference or acknowledgement of the code base for fear of simply overloading ourselves with everyone's personal requests. Any ideas?
Author

I suppose it would be better if users were to put all feature requests in a bottle, and imbide it rectally?

I suppose it would be better if users were to put all feature requests in a bottle, and imbide it rectally?

No, I think that would be unhealthy ;)
There is already some discussion in addition this code to the logic bricks. However, I personally noticed that the information available isn't intuitive. Bullet creates contact points for intersections, and determines their impulse based on a number of factors, which doesn't seem to agree with substeps. Essentially it doesn't seem easy to determine the hit force, or impulse over a collision so that we can compare collision strength - Its not reliable. Furthermore, we only return one contact point at the moment, when in reality there are 2n points (one for each body).
Of of these things stand in the way of getting this done, however we currently have rather larger issues to deal with (just see panzergame's commits on materials).

No, I think that would be unhealthy ;) There is already some discussion in addition this code to the logic bricks. However, I personally noticed that the information available isn't intuitive. Bullet creates contact points for intersections, and determines their impulse based on a number of factors, which doesn't seem to agree with substeps. Essentially it doesn't seem easy to determine the hit force, or impulse over a collision so that we can compare collision strength - Its not reliable. Furthermore, we only return one contact point at the moment, when in reality there are 2n points (one for each body). Of of these things stand in the way of getting this done, however we currently have rather larger issues to deal with (just see panzergame's commits on materials).
Author

where can I browse commits?

how would I go about gathering the impulse over time and then using the frame time to correct?

or is it impossible at the moment?

where can I browse commits? how would I go about gathering the impulse over time and then using the frame time to correct? or is it impossible at the moment?

Commits can be browsed by cloning the git repository and browsing the commit logs, or here https://www.miikahweb.com/en/blender/git-logs/

Bullet generates collision contact points in something called a collision manifold. These contacts have appliedImpulse values that can be read. The total impulse is the vector sum of these impulses, using the normal for each contact to generate a vector (normal * impulse).

Impulse = average force * time, so you have to divide the total impulse by the lifetime of the contact, but this isn't necessarily very clear, because a collision is happening over a long period of time, sometimes. Hence, it's best to take the sum the impulse over the time the collision is happening until it stops, then use that time value or something. Unfortunately, this isn't very clear in Bullet at the moment.

Commits can be browsed by cloning the git repository and browsing the commit logs, or here https://www.miikahweb.com/en/blender/git-logs/ Bullet generates collision contact points in something called a collision manifold. These contacts have appliedImpulse values that can be read. The total impulse is the **vector** sum of these impulses, using the normal for each contact to generate a vector (normal * impulse). Impulse = average force * time, so you have to divide the total impulse by the lifetime of the contact, but this isn't necessarily very clear, because a collision is happening over a long period of time, sometimes. Hence, it's best to take the sum the impulse over the time the collision is happening until it stops, then use that time value or something. Unfortunately, this isn't very clear in Bullet at the moment.

No need to rely on a 3rd party site, our commits can also be browsed at https://developer.blender.org/diffusion/B/history/master/

@JacobMerrill-1 wrote:
Proposal - Add Collision.hitPosition

What Collision class are you referring to? Do you mean bpy.types.CollisionSensor?

this would be easier for most to get the hang of, then a callback, as well as match the existing API.

The callbacks are part of the "existing API" now, so we can't really change that. We could extend the collision sensor to include such a property. A problem with this is that the property can only be read at every logic tick, and not at every physics tick, which is why I didn't implement this in the first place.

No need to rely on a 3rd party site, our commits can also be browsed at https://developer.blender.org/diffusion/B/history/master/ > @JacobMerrill-1 wrote: > Proposal - Add Collision.hitPosition What Collision class are you referring to? Do you mean [bpy.types.CollisionSensor](https://www.blender.org/api/blender_python_api_2_76_9/bpy.types.CollisionSensor.html)? > this would be easier for most to get the hang of, then a callback, as well as match the existing API. The callbacks are part of the "existing API" now, so we can't really change that. We could extend the collision sensor to include such a property. A problem with this is that the property can only be read at every logic tick, and not at every physics tick, which is why I didn't implement this in the first place.
Sybren A. Stüvel removed their assignment 2017-02-02 15:43:23 +01:00

Added subscriber: @satishgoda1

Added subscriber: @satishgoda1
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2019-06-29 02:23:37 +02:00
Member

This task is being closed because the BGE has been removed in Blender 2.8.

This task is being closed because the BGE has been removed in Blender 2.8.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#44051
No description provided.