当前位置:网站首页>Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
2022-07-07 10:48:00 【HCC2017】
public class Script : MonoBehaviour {
public GameObject obj;
public float s;
void Update () {
Ray ray = new Ray();
RaycastHit hit;
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Input.GetMouseButton(0))
{
if (Physics.Raycast(ray,out hit,100))
{
obj.transform.position = new Vector3(hit.point.x,hit.point.y,0);
}
}
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
s += Input.GetAxis("Mouse ScrollWheel");
obj.transform.localScale = new Vector3(s, s, s);
}
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
s += Input.GetAxis("Mouse ScrollWheel");
obj.transform.localScale = new Vector3(s, s, s);
}
}
}
边栏推荐
- Kotlin realizes wechat interface switching (fragment exercise)
- Cluster task scheduling system lsf/sge/slurm/pbs based on HPC scenario
- Network engineer test questions and answers in May of the first half of 2022
- 【实战】霸榜各大医学分割挑战赛的Transformer架构--nnFormer
- What is an intermediate network engineer? What is the main test and what is the use?
- 路由器开发知识汇总
- Schnuka: working principle of robot visual grasping machine visual grasping
- 深入理解Apache Hudi异步索引机制
- openinstall与虎扑达成合作,挖掘体育文化产业数据价值
- Prototype and prototype chain
猜你喜欢

香橙派OrangePi 4 LTS开发板通过Mini PCIE连接SATA硬盘的操作方法

软考信息处理技术员有哪些备考资料与方法?

Leetcode-304: two dimensional area and retrieval - matrix immutable

The difference between monotonicity constraint and anti monotonicity constraint

5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!

如何顺利通过下半年的高级系统架构设计师?

在线硬核工具

枪出惊龙,众“锁”周之

CAS机制

BUUCTF---Reverse---reverse1
随机推荐
在线硬核工具
MySQL insert data create trigger fill UUID field value
Some superficial understanding of word2vec
IDA中常见快捷键
How to prepare for the advanced soft test (network planning designer)?
Is the gold content of intermediate e-commerce division in the soft exam high?
I plan to take part in security work. How about information security engineers and how to prepare for the soft exam?
无法打开内核设备“\\.\VMCIDev\VMX”: 操作成功完成。是否在安装 VMware Workstation 后重新引导? 模块“DevicePowerOn”启动失败。 未能启动虚拟机。
Multithreaded asynchronous orchestration
What is an intermediate network engineer? What is the main test and what is the use?
中级软件评测师考什么
[recommendation system 01] rechub
Find the greatest common divisor and the least common multiple (C language)
施努卡:机器视觉定位技术 机器视觉定位原理
Hdu-2196 tree DP learning notes
【推荐系统 02】DeepFM、YoutubeDNN、DSSM、MMOE
String formatting
What does intermediate software evaluator test
南航 PA3.1
SQL Server 知识汇集11 : 约束