Welcome Guest [Log In] [Register]
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:

Username:   Password:
Add Reply
Terrain renderer + trigoniometry; two questions
Topic Started: Nov 22 2010, 07:23 PM (148 Views)
DmitriV
Member Avatar
Advanced Member
[ *  *  * ]
I have got two questions,

The first one is about the terrain renderer:
I've got a weird high wall around my whole terrain, while the heightmap is good (I supose)
Spoiler: click to toggle


How can I get rid of these weird walls?


My seconde question is about trigonometry. I'm rather good with it, but I can't get this working. I've got a weapon in the game, as you can see in the screenshots, and the horizontal rotation works fine. Since the weapon hasn't got the same x and y coordinates as the camera, trigonometry is needed to calculate the correct location. Now, when I want to rotate the camera vertically, the weapon goes almost off-screen. This is because the weapon is 5 (z-units) lower than the camera. I've tried to fix it, but it solves the problem on the wrong way...

Code:
 

roty = camera.roty;
rotx = camera.rotx;

x = camera.x+4*cos(-degtorad(camera.roty-30));
y = camera.y+4*sin(-degtorad(camera.roty-30));
z = camera.z+camera.height-5;


And my second attempt:
Code:
 

roty = camera.roty;
rotx = camera.rotx;

x = camera.x+4*cos(-degtorad(camera.roty-30))*4*cos(degtorad(camera.rotx))/4;
y = camera.y+4*sin(-degtorad(camera.roty-30))*4*cos(degtorad(camera.rotx))/4;
z = camera.z+camera.height-5;

I think I've swapped the x and y coördinates somehow, because when I look up now the weapon goes horizontally off-screen. Oh, and does a method exists to do this trigonometry in U3D, it could be fasther than GM...

Regards,
DmitriV
Edited by DmitriV, Nov 22 2010, 08:20 PM.
Newbie in U3D...
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply