Read Physics type from KX_GameObject #35680

Closed
opened 2013-06-09 01:38:11 +02:00 by Angus Hollands · 24 comments

%%%Adds a physics_type attribute to KX_GameObject
Adds Physics enums to bge.logic

KX_PHYSICS_STATIC
KX_PHYSICS_ACTOR
KX_PHYSICS_SENSOR
KX_PHYSICS_ACTOR_SENSOR
%%%

%%%Adds a physics_type attribute to KX_GameObject Adds Physics enums to bge.logic KX_PHYSICS_STATIC KX_PHYSICS_ACTOR KX_PHYSICS_SENSOR KX_PHYSICS_ACTOR_SENSOR %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

#40341 was marked as duplicate of this issue

#40341 was marked as duplicate of this issue

%%%You've documented the new constants, but didn't document the new KX_GameObject.physics_type attribute. Also, despite the existing inconsistencies, physics_type should probably be physicsType. Can a game object actually have a type of KX_PHYSICS_ACTOR_SENSOR? I'm also not entirely sold on the KX_PHYSICS_* prefix either (it would seem like we'd want to use this for something else), however, I cannot think of a better prefix off hand.%%%

%%%You've documented the new constants, but didn't document the new KX_GameObject.physics_type attribute. Also, despite the existing inconsistencies, physics_type should probably be physicsType. Can a game object actually have a type of KX_PHYSICS_ACTOR_SENSOR? I'm also not entirely sold on the KX_PHYSICS_* prefix either (it would seem like we'd want to use this for something else), however, I cannot think of a better prefix off hand.%%%
Author

%%%I've added a new patch with the documentation fixed. I've renamed it to physicsType (not sure why it wasn't before!).
Objects can be ACTOR_SENSOR - this denotes SENSOR objects which detect actors. It could be renamed to SENSOR_DETECT_ACTORS if needs be.%%%

%%%I've added a new patch with the documentation fixed. I've renamed it to physicsType (not sure why it wasn't before!). Objects can be ACTOR_SENSOR - this denotes SENSOR objects which detect actors. It could be renamed to SENSOR_DETECT_ACTORS if needs be.%%%

%%%Can we determine if an object is set to No Collision? It would be nice if this property returned similar results to that of bpy: http://www.blender.org/documentation/blender_python_api_2_67_1/bpy.types.GameObjectSettings.html#bpy.types.GameObjectSettings.physics_type%%%

%%%Can we determine if an object is set to No Collision? It would be nice if this property returned similar results to that of bpy: http://www.blender.org/documentation/blender_python_api_2_67_1/bpy.types.GameObjectSettings.html#bpy.types.GameObjectSettings.physics_type%%%
Author

%%%Made modifications as requested. Now we don't use the ClientObjectInfo struct, but instead handle the mapping in scene conversion.%%%

%%%Made modifications as requested. Now we don't use the ClientObjectInfo struct, but instead handle the mapping in scene conversion.%%%

%%%I'm starting to wonder if this is something we want to actually have go through the physics module instead of KX_GameObject. Something like:

constraint.getPhysicsType(gameobj)

It's more round-about, but it also keeps physics settings out of KX_GameObject.%%%

%%%I'm starting to wonder if this is something we want to actually have go through the physics module instead of KX_GameObject. Something like: constraint.getPhysicsType(gameobj) It's more round-about, but it also keeps physics settings out of KX_GameObject.%%%
Author

%%%If that was the case, I'd be much happier if we renamed constraints to physics, because it really is much more than just constraints. I've just had a thought (I'm away from home) in how would LibLoaded objects interact with scene conversion (I presume rarely)?%%%

%%%If that was the case, I'd be much happier if we renamed constraints to physics, because it really is much more than just constraints. I've just had a thought (I'm away from home) in how would LibLoaded objects interact with scene conversion (I presume rarely)?%%%
Author

New file fixes ugly code from before (we can just make use of blenderobject->body_type), and ensures all objects (not just physics objects) are considered.
Also includes isActor and isGhost.
Renames record_animation to recordAnimation to keep style conventions.

Yes, ideally we wouldn't deal with a convoluted KX_GameObject namespace, but that is a more fundamental engine design issue, in my opinion. Per your suggestion, we might as well move all physics information, which would not be convenient. Instead, the best solution would be to group this data on the object, but then we're looking and components, aren't we! :)

New file fixes ugly code from before (we can just make use of blenderobject->body_type), and ensures all objects (not just physics objects) are considered. Also includes isActor and isGhost. Renames record_animation to recordAnimation to keep style conventions. Yes, ideally we wouldn't deal with a convoluted KX_GameObject namespace, but that is a more fundamental engine design issue, in my opinion. Per your suggestion, we might as well move all physics information, which would not be convenient. Instead, the best solution would be to group this data on the object, but then we're looking and components, aren't we! :)

Added subscriber: @raco

Added subscriber: @raco

Just a suggestion. I know you guys put a lot attention to this already, but I would prefer a different design/approach.

  • KX_GameObject.ghost (Type: boolean) instead of isGhost.
  • KX_GameObject.actor (Type: boolean) instead of isActor.
  • KX_GameObject.physics_type (Type: string) which can be 'NO_COLLISION', 'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID', 'SOFT_BODY', (...), like it is with the bpy.

Of course, these attributes shouldn't be limited to read-only. So, for example, it's possible to set KX_GameObject.physics_type to 'NO_COLLISION' instead of replacing the mesh.

Just a suggestion. I know you guys put a lot attention to this already, but I would prefer a different design/approach. - KX_GameObject.ghost (Type: boolean) instead of isGhost. - KX_GameObject.actor (Type: boolean) instead of isActor. - KX_GameObject.physics_type (Type: string) which can be 'NO_COLLISION', 'SENSOR', 'STATIC', 'DYNAMIC', 'RIGID', 'SOFT_BODY', (...), like it is with the bpy. Of course, these attributes shouldn't be limited to read-only. So, for example, it's possible to set KX_GameObject.physics_type to 'NO_COLLISION' instead of replacing the mesh.

I wish to add:

  • KX_GameObject.compound (Type: boolean)
I wish to add: - KX_GameObject.compound (Type: boolean)

Added subscriber: @mahalin

Added subscriber: @mahalin

Added subscriber: @solarlune

Added subscriber: @solarlune
Member

Added subscriber: @brita

Added subscriber: @brita
Member

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1
Member

◀ Merged tasks: #40341.

◀ Merged tasks: #40341.
Member

@AngusHollands-4 can you get this in a phabricator diff?

@AngusHollands-4 can you get this in a phabricator diff?
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Any way on updating this for the current master if not we can archive this patch?

Any way on updating this for the current master if not we can archive this patch?

Removed subscriber: @mahalin

Removed subscriber: @mahalin

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2015-09-16 19:31:19 +02:00

Archiving for now, we can always reopen should the requested points be addressed/answered.

Archiving for now, we can always reopen should the requested points be addressed/answered.
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
9 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#35680
No description provided.