| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
| setting the "origin" of a texture textures; so u can rotate it around center of tex | |
|---|---|
| Tweet Topic Started: Oct 1 2008, 09:00 AM (260 Views) | |
| Bazza | Oct 1 2008, 09:00 AM Post #1 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
is there a way to set the origin of the tex so when u rotate it, it stays in the same position kind of like how rotating a model works but 2d |
| My instinct is to hide in this barrel, like the wily fish. | |
![]() |
|
| MysteriXYZ | Oct 1 2008, 05:14 PM Post #2 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
What are "texture textures" ?You mean "billboard texture", don't you ?If I understood correctly, you want to rotate the texture of a 2D primitive, right? Yes, you could use a billboard, but I am going to show you how you can transform a texture on a polygon instead. Rotating a texture around its centre is still reasonably simple (you could use simple trigonometry), but the script I will give you will allow you to transform the texture in any way you want. And yes, this will once again involve matrices and vectors, so you better hold on to your hat !First, create the polygon like this:
Creating it like this should make the polygon easy to use. Then you call the following script in its Step Event (you don't even need to call Step()!):
|
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| ashrat3000 | Oct 1 2008, 10:02 PM Post #3 |
|
u3d raytracer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
However, if you mean the textures drawn with DrawTex(), its impossible. Well, maybe not. You may be able to use DrawTexEx() and the clipping things (args 2,3,4,5 [I think]) and then rotate. It may just work. |
|
그대를 사랑해 | |
![]() |
|
| skarik | Oct 2 2008, 01:04 AM Post #4 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yeah, what you do is you take the length and width, calculate a hypotenuse from that, divide it by two, and use the lengthdir_x and y to move the image to it's center. That way, you'll always have it centered. That's what I do all the time. |
| Blog|EHS | |
![]() |
|
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |





![]](http://z1.ifrm.com/static/1/pip_r.png)



?
?
!
2:48 AM Jul 11