Advertisement

Texture Mapping Question.

Started by April 12, 2003 08:04 AM
5 comments, last by Xnin 21 years, 10 months ago
Hi Ive got a rectangle which i can texture map perfectally. The problem is that with rectangle, its harder to do collision detection. So i want to change it to a square and the texture map is. But when i map a picture into the square, its squashed. Is there a way which allows me to map the texture the way it is without resizing/scalling it to fit the shape? Thank You
Harder to to collision detection with rectangles? Better look at how you''re doing your collision detection...

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
Advertisement
A rectangle is the exact same thing as two triangles, hence you can perform collision detection as if they were triangles... Which is usually how it is done..
The way im doing collision is just a simple crappy way. Take a square (pretend thers a circle around it), measure the summ of the radius of both objects, if its greater the distance then theres no collision etc ....

Is the triangle way simple? If so how is it done then?



Thanks :
I didn''t quite understand how you were doing it, but it didn''t sound very efficient...

It depends on what is going to collide with what in you enviroment... The easiest is probably to represent the camera with a bounding-sphere, and everything else as... well, triangles.

There are many, many articles about collision deetection, go read them.
Ok sorry, ill explain more.

What i first wanted was very simple collision detection (Not efficient i know, but dont care either, just a simple crappy game). So what i do was get a square and treat it like a circle with radius etc.... then add the summ of the radii and if they are less then the disteance between the 2 objects then they are colliding. I posted a thread about that and someone told me that way. Its crap, i know, but im happy with it

Problem:
That only works great for a square (cause all sides are equal, therefore, the "radius" is equal). If i have a rectangle, its more difficult cause the its got different size lengths etc... So what i want is to use a square to draw my car and then map an image into it, but the image looks sqaushed and crap (cause its a square). I want to know if there is a way to map an image into the square "the way it is" i.e. without being stretched to fit the square etc...So just map the image the way it looks like in the center of the square for example.
Advertisement
It''s exactly the same for a rectangle as a square. The radius of the smallest circle that encompasses a square is the distance from it''s centre to one of it''s vertices, the same is true for a rectangle... A square is simply a special case rectangle.

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.

This topic is closed to new replies.

Advertisement