ReworldDevs / ReworldScripts

Alpha phase Lua scripting for Reworld games
0 stars 0 forks source link

Text Field Update Bug #1

Open ReworldDevs opened 5 years ago

ReworldDevs commented 5 years ago

Object properties appear to be tied to text field in the Reworld editor. After changing an object's velocity in script, the object velocity should return to 0 after the object has landed back on the floor and stopped moving. However, the Velocity parameter does not actually update until you manually click on the object in the text field. This makes it very difficult to rapidly update the part's velocity.

Kougamin commented 5 years ago

Hi,ReworldDevs, I'm Mammal from Beijing, Sorry I don't really sure if I understand this bug issue,could you describe the using situation specifically? With the original codes and functions you want to achieve, I'll see if I can recurrent it myself.

ReworldDevs commented 5 years ago

Hi Mammal, thanks for the response. Here is the code we used:

local flappy = WorkSpace.Flappy local velY = 7

function onKeyPressSpace() flappy.Velocity = Vector3.New(0,velY,0) end

ContextActionService.BindInput("keyPressSpace", onKeyPressSpace, false, Enum.KeyCode.Space)

This script creates a custom key binding where the Y velocity of the part "flappy" is set to 7 when Space is pressed. However, the velocity does not reset to 0 when the object lands on the ground until you manually click on the part in WorkSpace. Which means the object velocity cannot be changed again until the object is manually selected.

ReworldDevs commented 5 years ago

So far we have had multiple instances where Velocity variables being changed in the script does not appear to have an effect when being played, until I manually select them in WorkSpace, upon which the variable suddenly updates. This appears to be a pretty serious bug that will affect any game development that involves moving parts.

ReworldDevs commented 5 years ago

*never mind, we found a solution that works with the BodyVelocity object I think a deeper related problem is that there is no constant velocity option. Parts seem to be affected by air friction in this engine, and velocity will decrease no matter what. In order to work around this, we have to keep resetting the Velocity variables. If there exists a constant velocity option, where air friction doesn't affect the part, moving parts would be much easier to operate.

Kougamin commented 5 years ago

About the constant velocity option you mentioned,I think there's a solution about it, there's a checkbox button about gravity in "Part", and this option is checked by default, you can just cancel it , then the velocity you edit to your part will maintain a constant speed. 00bdf8a258ee01d179a4a834a48a74c

ReworldDevs commented 5 years ago

If you were able to open the Flappy Bird prototype we sent over yesterday, maybe you can see what we meant. In the code that makes the bird jump by pressing space, we had to constantly vary the amount that we set y-velocity. image

Removing that line of code would make the bird only be able to jump once. I suspect this is because the part of Reworld that handles Position, Scale, Velocity, etc properties all rely on changes in the Properties window, because that would also explain the bug where German and French users could not scale below (2,2,2). But it is still just my guess based on the fact that these all have to do with the properties window and how the textfields in it interact with object properties and the physics engine

--Ruofan.

Kougamin commented 5 years ago

Oh, I see, you're right, I reproduced it on my PC, and it is very clever that you change your Velocity like that, but I think this kind of function is not very appropriate for mobilephone games. I will give you another method to achieve this function: First: create a UI interface with a button: then add a LuaLocalScript(Clientscript) in it, image

Second: name your part in your WorkSpace(mine is FlappyMammal). Add a force on it, image

Third: Write codes in the LuaLocalScript: image

then you will find when you press the key(Jump), the part will jump, when you loose the key,the part will drop. I hope this kind of method will help you with other situations