Scaling and Collisions
-
- Posts: 17
- Joined: Tue Jul 16, 2013 10:27 pm
- Contact:
Re: Scaling and Collisions
Scaling definitely works so I assume you mean you are dynamically scaling your game object at runtime? In that case give this a try after changing the scale of your game object: Chipmunk.UpdatedTransform(gameObject);
-
- Posts: 8
- Joined: Fri Aug 16, 2013 10:42 am
- Contact:
Re: Scaling and Collisions
Does this apply to any changes to transform? I noticed some weirdness when I directly manipulate transform.position for an object- it didn't always seem to actually move the object. In my head it made sense that you might need to notify the physics engine that a transform has been moved.
-
- Posts: 17
- Joined: Tue Jul 16, 2013 10:27 pm
- Contact:
Re: Scaling and Collisions
@runonthespot - yes, I believe any change to the tranform requires this. Wouldn't you be better setting the position of the Chipmunk body though?
-
- Posts: 8
- Joined: Fri Aug 16, 2013 10:42 am
- Contact:
Re: Scaling and Collisions
Not really sure. In my case, I'm laying out a bunch of objects in a pattern on screen, initial layout. In my physx implementation, I just set the transform position....?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Scaling and Collisions
So the problem is that Unity doesn't provide any generic way to tell if a transform has been changed. They can do it in the engine itself, but that's not exposed for scripts to use. So when you change the transform values, Chipmunk has no way of knowing that anything has changed.
The next best idea we had was to cache the transform's position, rotation and scale values and compare them each frame. That would be mildly expensive, and changes wouldn't be picked up until the next fixed time step. Unity 4.x+ provides a boolean that you can manually set and check for changed transforms, but it's shared by all of the scripts on a game object. That's not really a generic solution either. So Chipmunk Chipmunk.UpdatedTransform() was the best we could do. :-\
The next best idea we had was to cache the transform's position, rotation and scale values and compare them each frame. That would be mildly expensive, and changes wouldn't be picked up until the next fixed time step. Unity 4.x+ provides a boolean that you can manually set and check for changed transforms, but it's shared by all of the scripts on a game object. That's not really a generic solution either. So Chipmunk Chipmunk.UpdatedTransform() was the best we could do. :-\
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 6 guests