Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Object rotation around character not working(shadow problem as well)

Author
Message
sanba music
14
Years of Service
User Offline
Joined: 5th Jan 2010
Location:
Posted: 6th Jan 2010 01:32
I want a sword to always appear in front of the player, but it is only rotating with the player for about 180 degrees. Once it hits a limit, the sword rotates the opposite direction and meets the player at the opposite end.

Notice that the angles seem to go into the negative, and when the angle reaches above 90 or below -90, the sword disappears completely.

What do I need to do to fix this?

Also, the shadow effects seem to be going in the wrong direction...what's up with that?

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Jan 2010 19:13
You need to base the sword's angle upon the camera's orientation. Change your Sword() function to this:


and your MouseTarget() function to this:



and it should look something like the attached pic.

I don't have enough time to help with the lighting issue. It seems like using shading on everything is going to kill your frame rate. Also, you should delete all of the objects, images, etc. upon leaving the game.

So many games to code......so little time.

Attachments

Login to view attachments
SanBa Games
14
Years of Service
User Offline
Joined: 28th Nov 2009
Location: Silicon Valley
Posted: 6th Jan 2010 19:14 Edited at: 6th Jan 2010 19:20
Thanks alot for your help!

I had just figured out something by using YROTATE OBJECT instead of TURN OBJECT LEFT.

Before, we were using "TURN OBJECT LEFT" and "TURN OBJECT RIGHT," then reporting back the OBJECT ANGLE Y() of the object being turned. As soon as I set the turning code to work using YROTATE OBJECT, it began to work. So why do the turn object commands report back faulty object angles?

Also, the shadow problem is not yet fixed. In fact, on SanBa Music's computer the lines at the beginning that say HIDE LIGHT 0 and SET AMBIENT LIGHT 0 work fine, but on my computer I had to push them ahead to right before the DO loop, or else the scene would be fully lit. There is absolutely no reason I can think of for that! And still, the shadows are only following light 0 even though light 0 is turned off. I understand that shadows may only be able to follow one light at a time, and that we may have to shut off all lights except the one closest to the player to get this to work, but still: why is the shadow following light 0, which is turned off? The shadows followed light 1 in my Pong clone.

Please, any help would be great, and the download above is only 65.5 k if anyone wants to download this and lend a hand.

EDIT: I see also in the picture you attached that the lighting and shading wasn't working properly for you either. Does anyone know why it only works on his computer, and everyone else needs to put the lighting commands later in the program? That seems awful weird to me.

Sanba Games: Because We Can

Login to post a reply

Server time is: 2024-09-28 14:26:56
Your offset time is: 2024-09-28 14:26:56