当前位置:网站首页>地球围绕太阳转
地球围绕太阳转
2022-07-06 09:18:00 【SQ刘】
地球围绕太阳转
新建Unity3D工程,做一些准备工作
1、新建2个3D球体,分别重命名为:Sun,Earth
2、在Project面板中,新建Texture,Material,Scripts文件夹
(1)在Texture文件夹下面,导入贴图素材(百度搜索太阳贴图、地球贴图即可。下面是我百度的素材)
(2)在Material文件夹下面,分别创建2个材质,将它们的Shader着色器更改下,如下图所示
(3)在Scripts文件夹下面,创建C#脚本,双击打开,编写代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class earthAroundSun : MonoBehaviour
{
public Transform sun;
void Update()
{
transform.RotateAround(sun.position, Vector3.up, 1f); //RotateAround是围绕另外一个点旋转
}
}
3、回到Unity3D,将Sun组件拖入Sun中,如下图
4、实现效果图
边栏推荐
- [offer29] sorted circular linked list
- 1041 be unique (20 points (s)) (hash: find the first number that occurs once)
- [899] ordered queue
- Minio file download problem - inputstream:closed
- C programming exercise
- (一)R语言入门指南——数据分析的第一步
- Game 280 weekly
- Redis 缓存更新策略,缓存穿透、雪崩、击穿问题
- 基于Redis的分布式锁 以及 超详细的改进思路
- Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights
猜你喜欢
There is no red exclamation mark after SVN update
FairyGUI人物状态弹窗
Theoretical derivation of support vector machine
记一次云服务器被密码爆破的经历——关小黑屋、改密码、改端口
(5) Introduction to R language bioinformatics -- ORF and sequence analysis
Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)
Teach you to release a DeNO module hand in hand
Unity scene jump and exit
Fairygui joystick
FairyGUI增益BUFF數值改變的顯示
随机推荐
Detailed explanation of truncate usage
Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights
MySQL replacement field part content
[Nodejs] 20. Koa2 onion ring model ----- code demonstration
(五)R语言入门生物信息学——ORF和序列分析
CUDA C programming authoritative guide Grossman Chapter 4 global memory
It has been solved by personal practice: MySQL row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT
基于Redis的分布式锁 以及 超详细的改进思路
(5) Introduction to R language bioinformatics -- ORF and sequence analysis
@The difference between Autowired and @resource
Unity3D,阿里云服务器,平台配置
Vulnhub target: hacknos_ PLAYER V1.1
[leetcode19]删除链表中倒数第n个结点
[Offer29] 排序的循环链表
Redis cache update strategy, cache penetration, avalanche, breakdown problems
[leetcode622] design circular queue
FairyGUI增益BUFF數值改變的顯示
Meanings and differences of PV, UV, IP, VV, CV
FairyGUI增益BUFF数值改变的显示
Teach you to release a DeNO module hand in hand