Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
FPS Mouse Look behavior with sensitivity support

sixvivid
Registered User
Quote
2024-01-20 08:28:34

I also don't want the mouse wheel to change the sensitivity. Just a setting in a menu, like a normal game!


writer
Guest
Quote
2024-01-20 08:34:04

now it doesn't work, probably due to cube updates


sixvivid
Registered User
Quote
2024-01-20 08:36:23

It only half works.

Also, is there nowhere to go to learn how to do these things myself???? Thats the ENTIRE reason i bought this engine was so I could do this. Now there is absolutely nowhere to f****** learn how to script PROPERLY


just_in_case
Moderator
Quote
2024-01-20 12:09:18

@sixvivid, I can understand your frustration, but please be patience, we are not readily available to answer the queries in real time.

The issues that you are facing with this particular extension can be due to many reasons.

First:- if you are trying the Sample file that comes with the extension, then you won't be able to make it work as expected.

because the sample files use, an incomplete behavior, to make it work properly. You need to copy the "behavior_MouseLook.js" file to your coppercube extension directory even if there is a file with the same name already exists there.

Hopefully, it will fix some of the issues that you are having with it.


The Original Issue

Now, let's talk about the original issue that you posted that you were unable to change the sensitivity with the help of variables.

It is happening Because

You were trying to access the variables as CopperCube variables, while the behavior uses Javascript variables and not the CopperCube variables.

So you are scripting your code in a very different way.

As you are writing your own script, I am assuming that you are familiar with the javascript, and if you are then there should be no issue for you to understand and analyze how the behavior is written.

and if you really want to script then you should learn javascript from websites like W3Schools, KhansAcademy, or try some Udemy javascript code.

So for getting the variables, you should simply use the javascript variables, that is available at the top of the behavior, as they are global variables.

You can access them anywhere in your game. Try using them in execute javascript action and change them directly like this.

Setting_Sens = 120;
Setting_SensH = 120;
Setting_SensV = 120;


this code will change the sensitivity for all to 120. you can use it on keypresses in proximity or at any event in your game.

It will work just fine.

Hope that this answers to your query :)






writer
Guest
Quote
2024-01-20 15:34:59

Sorry, but how can I turn off the change in intensity when scrolling the mouse wheel?


just_in_case
Moderator
Quote
2024-01-20 17:08:06

@writer, you need to edit the behavior and remove this chunk of code.

behavior_MouseLook.prototype.onMouseEvent = function(event, wdata){
/*
if(event == 0){
// raw axis values can be calculated here too, but in my testings,
// it was better to just calculate them in the update loop
this.xAxisRaw = (this.mouseX - this.screenW/2);
this.yAxisRaw = (this.mouseY - this.screenH/2);
}
*/
Setting_SensH += wdata;
Setting_SensV += wdata;
Setting_Sens += wdata;
}


then it will stop reacting to the mouse scroll.

Hope that helps :)


sixvivid
Registered User
Quote
2024-01-21 03:48:26

@just_in_case

Yes of course it was in my extensions folder.... lol

And that makes more sense, nothing explained that you cannot access a variable through coppercube "Set Variable"....

Thank you.


sixvivid
Registered User
Quote
2024-01-21 03:51:32

-> You were trying to access the variables as CopperCube variables, while the behavior uses Javascript variables and not the CopperCube variables.

I was not aware that the two couldn't interact, and this solves many of my issues, thank you @just_in_case


sixvivid
Registered User
Quote
2024-01-21 03:59:49

I must say that most of my issues im having are because I'm trying to push my limits with the engine and do things I have no clue how to do, however I have been using coppercube for years and am seeing a lot of things I could help teach about coppercube, alot of the questions I see asked on the forum are ones that I figured out on my own just spending time in the engine.

With the responsiveness of you admins I can't help but reccomend this engine to all beginners and experienced developers alike!


writer
Guest
Quote
2024-01-21 15:49:08

damn, in the transition to another scene it really doesn’t work, bro how can I solve this so that it works?
By the way, six vivid this was mentioned.


writer
Guest
Quote
2024-01-21 15:52:27

I can understand your frustration, but please be patience, we are not readily available to answer the queries in real time.

The issues that you are facing with this particular extension can be due to many reasons.

First:- if you are trying the Sample file that comes with the extension, then you won't be able to make it work as expected.

because the sample files use, an incomplete behavior, to make it work properly. You need to copy the "behavior_MouseLook.js" file to your coppercube extension directory even if there is a file with the same name already exists there.

Hopefully, it will fix some of the issues that you are having with it.


///
oh, I'll try this in my scene and not in the demo


writer
Guest
Quote
2024-01-21 16:06:28

It seems to me that I repeated everything as in the demo, but the behavior only works in the demo, something is wrong


writer
Guest
Quote
2024-01-24 18:58:54

The behavior is useful but it doesn’t work well, it conflicts with switching scenes, the camera rotation behavior is disabled, etc. I don’t know exactly what the problem is, but even when repeating everything that is in the demo, it doesn’t work, I wanted it to work, but alas, we apparently didn’t deserve the normal one


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact