Game Development Community

Changing t2dTextObject text w/out resize

by Eric Robinson · in Torque Game Builder · 04/03/2007 (7:42 pm) · 1 replies

Is there any way to change the text within a t2dTextObject without resizing it?

Specifically I want to be able to change the text within a t2dTextObject without modifying its collision boundaries. Changing the text results in a change in object size results in a change in collision radius.

Alternatively, is there a way to set a fixed collision radius for an object (setting the collision circle scale is a pain and seems to not work)?

#1
04/03/2007 (8:23 pm)
Nevermind, I got it:
// Changes the text of the object while fixing the collision circle.
function kanjiObject::collisionSafeSetText(%this, %text, %diameter)
{
	%this.text = %text;
	%this.setCollisionCircleScale(%diameter / %this.getWidth());	
}