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 / Camera angle (1.#INF)

Author
Message
Prophet Hill
15
Years of Service
User Offline
Joined: 5th Feb 2009
Location:
Posted: 26th Feb 2009 19:06 Edited at: 26th Feb 2009 19:10
Hi all, I'm trying to create a simple FPS. When I shoot, I want the gun to kick, I have the straight up part working, but I want it to go randomly left or right.

I set up variables: (kick = -1) & (kick2 = 1) and I say yrotate camera camera angle y() + kick or kick2

I can get it to consistently go left or right, but when I put the to together: "+ kick OR kick2" (instead of just (+ kick)) to go left or right it works for a bit then the camera angle(y) goes to 1.#INF.



When ever I use the command "OR" it puts me in that 1.#INF state, I couldn't figure out what was wrong at first then I printed the camera angle x() and camera angle y() and saw that. Last night I was doing it a different way and it went to something like 1.#QNAN.

Should I just stick with the straight up kick or can I figure this out? Help much app. Thanks!

ProphetHill
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Feb 2009 19:43
The compiler is carrying out a binary level 'or' on a floating point number.

Basically it's doing the equivalent of this:
(camera camera angle y() + kick) or kick2

When you want it to do this (I'd guess):
camera camera angle y() + (kick or kick2)

However, I don't think you will get what you expect from this - you'll only get a value or 1 or -1 if one of the variables is set to zero.

Prophet Hill
15
Years of Service
User Offline
Joined: 5th Feb 2009
Location:
Posted: 26th Feb 2009 19:54
Thanks for the quick reply!

Okay, How would I get the desired effect? I've tried a few things but they didn't work..

This gave same problem:


This only kicked left and never even went just up but always left:


And this gives an error "Could not determine parameter type of 'yrotate camera camera angley()' at line 175":


I'm still learning could you please tell me what I need to do? Thanks!

ProphetHill
Prophet Hill
15
Years of Service
User Offline
Joined: 5th Feb 2009
Location:
Posted: 27th Feb 2009 16:34
Anyone?

ProphetHill
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Feb 2009 18:41
Yes, do as I did - put brackets around the kick variables.

And as I also said earlier, I don't think you are doing what you think you are doing. The 'or' operator in DBPro is a binary-or ...

1 or 0 = 1
1 or -1 = -1
12345 or -1 = -1

As soon as you use -1 with an or operator, your result will be -1.

Maybe you just want to add them instead of or-ing them.

Login to post a reply

Server time is: 2024-09-28 02:19:08
Your offset time is: 2024-09-28 02:19:08