Obi Official Forum
Help Obi rope cutting not accurate - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Obi rope cutting not accurate (/thread-3209.html)

Pages: 1 2


Obi rope cutting not accurate - debruw - 30-11-2021

Hello i am using default rope cutting script. But my rope is not cutting where it appear on the screen. 

[attachment=1188]

When i try to cut on blue area it doesnt work. But when i try to cut on red area it cuts off the rope in blue area.

i will be glad if someone help me.


RE: Obi rope cutting not accurate - josemendez - 30-11-2021

(30-11-2021, 12:07 PM)debruw Wrote: Hello i am using default rope cutting script. But my rope is not cutting where it appear on the screen. 



When i try to cut on blue area it doesnt work. But when i try to cut on red area it cuts off the rope in blue area.

i will be glad if someone help me.

Hi,

What do you mean the "default rope cutting script"? There's no such thing, closest I can think of is the script that comes with one of the sample scenes...


RE: Obi rope cutting not accurate - debruw - 30-11-2021

(30-11-2021, 12:14 PM)josemendez Wrote: Hi,

What do you mean the "default rope cutting script"? There's no such thing, closest I can think of is the script that comes with one of the sample scenes...
Yes, i am using the script from sample scene.


RE: Obi rope cutting not accurate - josemendez - 30-11-2021

(30-11-2021, 12:40 PM)debruw Wrote: Yes, i am using the script from sample scene.

So we're talking about the RopeSweepCut script, right? This should work fine, all it does is take Input.mousePosition, unproject it to world space and calculate a line-line intersection.

Just make sure the camera object you've dragged into the script's "cam" property is the one you're actually looking trough. Otherwise it won't work.


RE: Obi rope cutting not accurate - debruw - 30-11-2021

(30-11-2021, 12:47 PM)josemendez Wrote: So we're talking about the RopeSweepCut script, right? This should work fine, all it does is take Input.mousePosition, unproject it to world space and calculate a line-line intersection.

Just make sure the camera object you've dragged into the script's "cam" property is the one you're actually looking trough. Otherwise it won't work.

Okay thanks!


RE: Obi rope cutting not accurate - martymayfly - 30-05-2022

(30-11-2021, 12:47 PM)josemendez Wrote: So we're talking about the RopeSweepCut script, right? This should work fine, all it does is take Input.mousePosition, unproject it to world space and calculate a line-line intersection.

Just make sure the camera object you've dragged into the script's "cam" property is the one you're actually looking trough. Otherwise it won't work.

Hi Jose, I have a problem with mobile builds, swipe and cut mechanic is not working on touch screens. Do you have any example for touch screens? Thanks!


RE: Obi rope cutting not accurate - josemendez - 30-05-2022

(30-05-2022, 11:56 AM)martymayfly Wrote: Hi Jose, I have a problem with mobile builds, swipe and cut mechanic is not working on touch screens. Do you have any example for touch screens? Thanks!

Hi!

The swipe script included with Obi is just an example, you're supposed to write your own. Take a look at Unity's API for touch screen input, shouldn't be too hard to convert the sample script so that it uses touches instead:

https://docs.unity3d.com/ScriptReference/Input.html
https://docs.unity3d.com/ScriptReference/Input.GetTouch.html


RE: Obi rope cutting not accurate - martymayfly - 31-05-2022

(30-05-2022, 12:11 PM)josemendez Wrote: Hi!

The swipe script included with Obi is just an example, you're supposed to write your own. Take a look at Unity's API for touch screen input, shouldn't be too hard to convert the sample script so that it uses touches instead:

https://docs.unity3d.com/ScriptReference/Input.html
https://docs.unity3d.com/ScriptReference/Input.GetTouch.html

Hi, 
First of all, your script is working in Unity but it is not working when i build on a real device (Samsung S7, iPhone 7..). By the way, Input.GetMouseButtonDown(0) can also be used for touch screens. But I have also tried Input.GetTouch in the code and build on a real device and nothing changed. 

Have you tested before Obi Rope swipe cut on mobile real devices? I'm working on mobile gaming and chose the Obi Rope to use on mobile. So, I will appreciate if you try on real devices and help me.
Thanks.


RE: Obi rope cutting not accurate - josemendez - 31-05-2022

(31-05-2022, 11:03 AM)martymayfly Wrote: Have you tested before Obi Rope swipe cut on mobile real devices? I'm working on mobile gaming and chose the Obi Rope to use on mobile. So, I will appreciate if you try on real devices and help me.
Thanks.

Hi,

Just tested the script on iOS (iPhone 7) and it works just fine.
Have you checked the console in XCode for null ref errors or other issues that would be preventing the script from running at all?

(31-05-2022, 11:03 AM)martymayfly Wrote: By the way, Input.GetMouseButtonDown(0) can also be used for touch screens.

Only if Input.simulateMouseWithTouches is enabled, and even then it only works for 1 touch (the first one). This is mentioned in the script's comments:

Code:
/**
 * Very simple mouse-based input. Not ideal for multitouch screens as it only supports one finger, though.
 */
private void ProcessInput()
    {



RE: Obi rope cutting not accurate - martymayfly - 31-05-2022

(31-05-2022, 11:12 AM)josemendez Wrote: Hi,

Just tested the script on iOS (iPhone 7) and it works just fine.
Have you checked the console in XCode for null ref errors or other issues that would be preventing the script from running at all?


Only if Input.simulateMouseWithTouches is enabled, and even then it only works for 1 touch (the first one). This is mentioned in the script's comments:

Code:
/**
 * Very simple mouse-based input. Not ideal for multitouch screens as it only supports one finger, though.
 */
private void ProcessInput()
    {

Hi Jose, 
The problem is about the shader code in AddMouseLine() method.
Code:
lineRenderer.sharedMaterial = new Material(Shader.Find("Unlit/Color"));


I don't know why but shader is null after that code. I created and assigned a material and it is working now. Last question; which solver backend do you recommend for mobile games, Oni or Burst? Thanks for your support.