Sprite Collision Rotation & Collision From Alpha
by Psp Goto · in Torque 2D Beginner · 01/09/2014 (6:35 pm) · 2 replies
Hey, two sprite questions for y'all here:
1) I have an sprite that moves around a bit, and when it collides with an object I want it to stay at it's original rotation. Is there a way to set rotation friction, or another way to keep the sprite not rotated?
2) I have a sprite with some transparent spacing around the actual image. Is there a way to eliminate the transparent parts, setting the collision to only the non-transparent parts automatically?
Sorry if these are weird questions, thanks
1) I have an sprite that moves around a bit, and when it collides with an object I want it to stay at it's original rotation. Is there a way to set rotation friction, or another way to keep the sprite not rotated?
2) I have a sprite with some transparent spacing around the actual image. Is there a way to eliminate the transparent parts, setting the collision to only the non-transparent parts automatically?
Sorry if these are weird questions, thanks
#2
Myobject.setAngularDamping(1.0);
As for point #2, You can check collisions against aabb, oobb or collision shapes; there is no per-pixel collision / picking in the engine. Note however that it can be added via C++ source "relatively" easily.
01/09/2014 (10:12 pm)
To add to Mike's point #1, you can also set the angular damping of your object to 1.0 (or higher, not sure if this uses values from 0.0 to 1.0), which will dampen all physical rotations on your object.Myobject.setAngularDamping(1.0);
As for point #2, You can check collisions against aabb, oobb or collision shapes; there is no per-pixel collision / picking in the engine. Note however that it can be added via C++ source "relatively" easily.
Associate Mike Lilligreen
Retired T2Der
2. There is no automatic way to set the collision shape to non-transparent parts of an image. You will have to manually edit the collision shape size to achieve this.